【问题标题】:Xcode 4 templates don't work in iOS 3.1.2Xcode 4 模板在 iOS 3.1.2 中不起作用
【发布时间】:2011-04-21 08:28:48
【问题描述】:

我想在旧手机上测试我的应用,并获得了一款 3.1.2。但是当我尝试运行它时,它只会显示启动画面然后崩溃。

然后我尝试使用 Xcode 4 模板制作一个基于 Hello World 视图的新应用程序,但即使使用此模板,它也可以构建良好但在启动时崩溃。我将部署目标设置为 3.1。

如果我尝试用 iPad 3.2 模拟器运行这个,它也会崩溃。

问题可能出在哪里?

当我在 iOS 设备上运行它时,它会给出这个警告然后停止,而不是真的崩溃:

警告:检测到 UUID 与加载的库不匹配 - 在磁盘上是: /Developer/Platforms/iPhoneOS.platform/DeviceSupport/3.1/Symbols/System/Library/Priv

更新: 我发现我之前出于某种原因在 DeviceSupport 文件夹中创建了从 3.1.2 (7D11) 到 3.1.2 的快捷方式。我删除了它,现在我不再收到警告了。只是崩溃;)

0 gdb-arm-apple-darwin
0x000000010010974a internal_vproblem + 308 1 gdb-arm-apple-darwin
0x0000000100109924 internal_verror + 27 2 gdb-arm-apple-darwin
0x00000001001099c2 align_down + 0 3
gdb-arm-apple-darwin
0x0000000100150c5e macosx_solib_add + 794 4 gdb-arm-apple-darwin
0x000000010016417c remote_macosx_complete_create_or_attach + 187 5 gdb-arm-apple-darwin 0x000000010016489e remote_macosx_create_inferior + 1252 6 gdb-arm-apple-darwin
0x000000010005f6c3 run_command_1 + 586 7 gdb-arm-apple-darwin
0x0000000100107b7f 执行命令 + 557 8 gdb-arm-apple-darwin
0x00000001000171e7 mi_execute_async_cli_command + 204 9
gdb-arm-apple-darwin
0x00000001000168e5 捕获_mi_execute_command + 344 10 gdb-arm-apple-darwin
0x0000000100072a62 catch_exception + 57 11 gdb-arm-apple-darwin
0x000000010001443e mi_execute_command + 140 12 gdb-arm-apple-darwin 0x0000000100077721 process_event + 133 13 gdb-arm-apple-darwin
0x0000000100078435 gdb_do_one_event + 1049 14 gdb-arm-apple-darwin
0x0000000100072b49 catch_errors + 70 /SourceCache/gdb/gdb-1518/src/gdb/macosx/macosx-nat-dyld.c:1648: 内部错误:无法识别的共享 库断点 内部问题 已检测到到 GDB,进一步 调试可能被证明是不可靠的。

当我运行 iPad 模拟器时,它在 HelloWorldAppDelegate.m 中的这一行崩溃: self.window.rootViewController = self.viewController;

带有此消息: 2011-04-21 11:46:09.006 HelloWorld[5492:207] *-[UIWindow setRootViewController:]:无法识别的选择器发送到实例 0x4c11bb0 2011-04-21 11:46:09.007 HelloWorld[5492:207] 由于未捕获的异常“NSInvalidArgumentException”而终止应用程序,原因:'** -[UIWindow setRootViewController:]:无法识别选择器发送到实例 0x4c11bb0'

更新: 这是通过这个解决的:

//  self.window.rootViewController = self.viewController;
    [self.window addSubview: [self.viewController view]];

【问题讨论】:

  • 尝试使用 NSLog() 找出应用程序在哪个点停止。
  • 我下载了一个新的 (4.0.2) 版本的 Xcode,现在它可以工作了。谢谢大家。

标签: objective-c xcode crash


【解决方案1】:

在您的应用委托中使用 [window addSubview: [myRootViewController view]]; 而不是 [window: setRootViewController: myRootViewController];

【讨论】:

  • 谢谢,这使它在 iPad 3.2 模拟器中工作,但旧 iPhone 仍然停止(没有错误)。
【解决方案2】:

我遇到了和你一样的问题,我从 Xcode 4 模板创建的每个应用程序都会给我你描述的错误。通过查看 Xcode 4 的在线文档中包含的一些示例代码,我发现如果我更换它,它可以在运行 3.1.3 的 iPhone 3G 上运行

self.window.rootViewController = self.navigationController;

[self.window addSubview:self.navigationController.view];

这对于运行 3.1.3 的 iPhone 来说是这样。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2012-11-16
    • 1970-01-01
    • 2020-04-02
    • 1970-01-01
    • 1970-01-01
    • 2023-03-11
    • 1970-01-01
    相关资源
    最近更新 更多