0

Working on an iPhone app for my company. Recently upgraded to XCode 4 (But kept an installation of XCode 3 in a separate folder).

The application, if compiled and run under XCode 3, runs stable and doesn't crash. If compiled and run under XCode 4, will run, open to an about screen, and will allow me to navigate to one of the other pages (a note-taking page) via the tab bar. But if I click on the other tab (a page containing almost nothing but a MKMapView), it crashes every time.

The exception is my iPod Touch, running iOS 5. That runs fine, so it seems the issue is XCode 4 on iOS4 (4.3.5 is what I'm currently testing on).

The crash log is here: http://pastebin.com/p0sXqbSZ

ThinkingStiff
  • 64,767
  • 30
  • 146
  • 239
Jordaan Mylonas
  • 1,261
  • 1
  • 11
  • 24
  • 2
    The logs seem pretty clear. "Unrecognised selector sent to instance". Why do you think there is a bigger issue? – Megasaur Aug 29 '11 at 00:24
  • Because no code has changed. Nothing has changed other than the version of XCode that I am using. All iOS4 devices run this project without issue under XCode 3. How can the same selector, running on the same device with the same OS be valid when compiled in one version of XCode, but invalid in another? – Jordaan Mylonas Aug 29 '11 at 00:28
  • 1
    Well, I have had a few strange issues with Xcode 4 that were solved by doing a clean first. At any rate UIImage is not NSCoding compliant. And there's the error. So you could at least post the code that ends up throwing this. – Megasaur Aug 29 '11 at 02:20

3 Answers3

1

If you're using Xcode 4.2 and iOS 5 SDK beta 5 or later, then you may be running into a bug in the SDK. See the accepted answer to this question.

There are workarounds. Here's the simplest one, first suggested by Kreuters:

@implementation UIImage (initWithCoder)

- (id)initWithCoder:(NSCoder *)aDecoder
{
     return nil;
}

@end

If you can reproduce the bug in Xcode 4.2 and iOS 5 SDK beta 7, you should file a bug report.

Community
  • 1
  • 1
Elliot
  • 6,086
  • 11
  • 45
  • 57
0

From the crash log it seems like a UIImage initalization causes the crash. If you have any [UIImage initWithCoder:] code, then try to comment it and look if if works then. If that really is the problem, then check if the Image is still added to your project, and/or re-import the image.

JonasG
  • 9,274
  • 12
  • 59
  • 88
0

Have you tried with the "Modernize Project", under "Editor"?

Aside from that, the problem seems to lie in the way apple stores the information from a xib file, because the [UIImage initWithCoder:] is being called when loading the UIViewController:

7   UIKit  0x31f98df3 -[UIImageView initWithCoder:] + 66
...
20  UIKit  0x3203b489 -[NSBundle(UINSBundleAdditions) loadNibNamed:owner:options:] + 92
21  UIKit  0x31f90cbd -[UIViewController _loadViewFromNibNamed:bundle:] + 36

I don't know if this helps, but try to look what has changed in the way xibs are created/retrieved, maybe a new feature that is clashing with something you've done. Or check any image that you're retrieving.

Can
  • 8,502
  • 48
  • 57
  • "Modernize Project" was not present in the Editors menu for me. There were also no modernization needed issues in the issue list. Looking at the .xib file, only 1 image is referenced. After removing that image, the issue persisted. – Jordaan Mylonas Aug 29 '11 at 04:16