Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

App update still points to old deleted nibs. How to resolve this without app re-install?

We have an app that is already live on app store.

Now we are planning to reduce the app size by programmatically creating all the views & removing respective NIB (XIB) files.

The problem is even when the nib is deleted & not called for, the updated version of the app still points to the old nib, and the issue like this comes up (this image is just an example, the problem is consistent throughout the app) :

enter image description here

Basically, the views get built up by both IB & code.

The only solution we have come up so far is to delete & re-install the app, but asking all the users to do that is undesirable. Moreover, it would also delete their locally stored app data, which is the main issue we are trying to avoid here.


For the above shown example, following code was used to load the ViewController:

Earlier (when the view was built using nib):

    TheNewVC *theNewVC = [[TheNewVC alloc] initWithNibName:@"TheNewVC" bundle:nil];
    [self presentModalViewController:theNewVC animated:YES];

Now (when the view is built programmatically, leading to above issue):

    TheNewVC *theNewVC = [[TheNewVC alloc] initWithNibName:nil bundle:nil];

    UINavigationController *addNavCon = [[UINavigationController alloc] initWithRootViewController:theNewVC];
    [self presentModalViewController:addNavCon animated:YES];

JFYI, even if TheNewVC *theNewVC = [[TheNewVC alloc] initWithNibName:nil bundle:nil]; is replaced by TheNewVC *theNewVC = [[TheNewVC alloc] init];, the problem remains same.


What solution could be there that doesn't involve re-installation of the app. Any way we could delete the nib cache that iOS is referring to, programmatically? OR in worse case, ask users to do that? Any help would be much appreciated.

like image 549
BufferStack Avatar asked Mar 03 '12 11:03

BufferStack


1 Answers

I assume you are running the app from within Xcode. Which does not clear out pre-existing resources from your app bundle. However when you install via the app store, I am sure it does clean your app bundle away and unzips the new version over the top (so old resources are cleared away..)

If you want to be double-sure your .xib won't be loaded, just rename the ViewController class and it will no longer load up the old xib (since it looks for a file called viewcontrollername.xib in the application bundle)

To do this go to the .h for the view controller, right click on the view controllers name, and select Refactor.

like image 68
Tony Million Avatar answered Sep 27 '22 22:09

Tony Million