Updating app on device with .xib removed crashes app

爷,独闯天下 提交于 2019-12-13 16:12:57

问题


I have an older version of an app installed on a device. In my new version I no longer had use of a .xib file as it changed from something complex to just a table view and I can instantiate it in code.

However, when I build and run on the device it crashes as it still tries to load the controller from the .xib file contained in the older app, and complains about a key/value pair missing for a UILabel.

For example:

SomeViewController.h (UITableViewController)
SomeViewController.m
SomeViewController.xib (removed in new version)

SomeViewController *controller = [[SomeViewController alloc] initWithStyle:UITableViewStylePlain];

- (id)initWithStyle:(UITableViewStyle)style
{
    self = [super initWithStyle:style];

    if (self)
    {
    }

    return self;
}

Even though I call "initWithStyle" it still tries to load the pre-existing .xib!

My current solution is to create SomeViewController.xib with a blank UITableView.

I suspect however, that when users update the app from the app store it will overwrite the entire app and not leave anything behind.

Is this true? Do app updates overwrite the existing app or does it leave lingering .xib files?

Now I have to test the older version with every other view to insure there is no other problems lingering.

Reading through the developer text on NIB's: http://developer.apple.com/library/ios/#documentation/Cocoa/Conceptual/LoadingResources/CocoaNibs/CocoaNibs.html

Perhaps I found a bug?

Another option is for me to re-name the class to something else like SomeController so as to avoid automatically loading the associated .xib file.


回答1:


Apple has addressed this issue in the following technical note regarding testing iOS app updates:

Technical Note TN2285




回答2:


Two recommandations:

  • Have you tried rebooting Xcode and the device that you use for your tests? (I have a long record of Xcode messing up cache management and keep using older versions of files)
  • Are you sure that your XIB file is not referenced by another one? (perhaps your main view has a Tab Bar Controller where you left the name of the XIB you removed)


来源:https://stackoverflow.com/questions/16136848/updating-app-on-device-with-xib-removed-crashes-app

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!