iOS App crashing before entering main() with Xcode 4.2 & iOS 5

后端 未结 12 2653
一整个雨季
一整个雨季 2020-12-10 12:50

Background

After upgrading xcode4.1/ios4 to xcode4.2/ios5 I am experiencing crashes while the App is loading and before it even enters main().

相关标签:
12条回答
  • 2020-12-10 13:10

    I tried everything in rjstelling and MarkGranoff's posts to no avail. I can now reproducibly cause it to not happen by turning off Guard Malloc on my debug scheme. Guard Malloc on--crash, off--no crash. I never had the problem on the device only the simulator. I applied the fixes in the post above first so I don't know if this would have fixed the problem without those changes or not. Hope this helps someone else.

    0 讨论(0)
  • 2020-12-10 13:10

    An app crashing before entering main.m can happen when a linked framework doesn't get copied, for example because the project uses Carthage and the Run Script build phase /usr/local/bin/carthage copy-frameworks is missing.

    0 讨论(0)
  • 2020-12-10 13:13

    You can apply the linker flag conditionally to iOS SDKs but not the iPhone Simulator in XCode 4.

    Select Other Linker Flags, click Add Build Setting, choose Add Conditional Setting, and apply -weak_library /usr/lib/libSystem.B.dylib just for iOS SDK.

    This lets simulator builds still work.

    0 讨论(0)
  • 2020-12-10 13:13

    In my case it was the -objc flag in Other Linker Flags. I had to remove that and it worked like a charm.

    0 讨论(0)
  • 2020-12-10 13:20

    Check your linker flags. Some libraries you might have been using required a flag like this:

    -weak_library /usr/lib/libSystem.B.dylib
    

    The weak linking allowed building against iOS 4.x with a 3.x deployment target. For whatever reason, it's completely broken in the simulator now.

    0 讨论(0)
  • 2020-12-10 13:22

    I seem to remember having had a similar crashing bug prior to main() being called and I tracked it to a mismatch between IBOutlets declared in app delegate vs in my nibs. Go through and check your outlets to see if any are somehow misconfigured.

    -mz

    0 讨论(0)
提交回复
热议问题