iOS应用程序在使用Xcode 4.2&进入main()之前崩溃iOS 5 [英] iOS App crashing before entering main() with Xcode 4.2 & iOS 5

查看:143
本文介绍了iOS应用程序在使用Xcode 4.2&进入main()之前崩溃iOS 5的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

背景



升级后。据我所知,我的应用程序不使用ARC,也不使用任何依赖库。答案还说了一些关于弱参考归零的东西,这似乎是......可能是相关的,因为很多人已经成功地删除了关于对libSystem.B.dylib的弱引用的特定链接器指令。



让我感到困扰的是,我必须将我的基本部署目标提升到4.0以上,因为这让我觉得我正在削减很多潜在用户。尽管Apple希望每个人都能永远升级他们的设备,但许多人却没有。好吧。



编辑



值得一提的是,这个项目最初是在Xcode3下完成的,所以有可能只是项目本身的一些奇怪的残余,这是不必要的,并导致这个问题。但如果我能找到它,我会被诅咒!



编辑2



嗯,好吧。 ..经过进一步检查......我在我的project.pbxproj文件中发现了2个错误的libSystem.B.dylib引用,这些引用是通过Xcode的构建设置看不到的,但我必须用文本编辑器手动删除!



执行此操作后,我将基本部署版本重置为4.0,为iOS5模拟器构建,应用程序运行时没有问题。



很棒。



上一课:永远不要低估项目文件中存在垃圾的可能性。



< h2>编辑3



在Xcode项目包中的 project.pbxproj 文件中删除这些行的3次出现(右键单击并显示包内容)。




Background

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

I have set a break point in main() but it is never reached.

  • Compiling the project in Xcode 4.1 with a Base SDK of 4.3 works fine on iOS 4.x and iOS 5.
  • Compiling the same project in Xcode 4.2 with a Base SDK of 5.0 works fine on 4.x but crashes in iOS 5, both on the simulator and on a device.

Simulator Crash

Crashes with EXC_BAD_ACCESS

List of calls, all system calls, not even the main() has not been called yet.

My best guess is a problem loading a library, but have know idea how to track it down!

Attempts at a resolution

  1. Turned on Zombies
  2. Turned on all logging
  3. Added different versions of system libraries (libz.1.2.5.dylib and libz.dylib)
  4. Cleaned the project
  5. Deleted the App form the simulator
  6. Delete the Derived Data folder

解决方案

What is your deployment target?

My deployment target was iOS4.0. I changed it to iOS4.3 and the issue is resolved! (Building against iOS5 GM SDK, of course.) My app now runs in the iOS5 simulator.

I got this idea from an answer in another SO thread that said ARC is supported in iOS4.3 and above. My app doesn't use ARC, nor do any of it's dependent libraries, as far as I can tell. The answer also said something about weak reference zeroing, which seemed... perhaps relevent since a lot of people have had success in removing specific linker directives concerning weak references to libSystem.B.dylib.

It bothers me a little that I have to move up my base deployment target beyond 4.0 because that feels like I am cutting out a lot of potential users. Despite Apple's hope that everyone will always upgrade their devices, many people do not. Oh well.

EDIT

It's worth mentioning that this project was originally done under Xcode3, so there is likely just some bizarre cruft in the project itself that is both unneeded and causing this problem. But I'll be damned if I can find it!

EDIT 2

Well, well, well... upon further inspection... I found 2 errant references to libSystem.B.dylib in my project.pbxproj file that were not visible through Xcode's build settings, but that I had to remove by hand with a text editor!

Once doing this, I reset the base deployment version to 4.0, built for the iOS5 simulator, and the app ran without issue.

Amazing.

The lesson: Never underestimate the chances for there to be garbage in your project file.

EDIT 3

Removing the 3 occurrences of these lines in the project.pbxprojfile inside the Xcode project package (right click and show package contents).

这篇关于iOS应用程序在使用Xcode 4.2&amp;进入main()之前崩溃iOS 5的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆