0

我在客户 iPhone(运行 iOS 5.1)上发生了奇怪的崩溃,我在 iOS 6 上使用以下代码完全没有问题:

- (IBAction)projectButtonPressed:(id)sender
{
   MEProjectViewController *viewController = [[MEProjectViewController alloc] initWithNibName:@"MEProjectViewController" bundle:nil];
   MEProjectNavigationViewController *navigationController = [[MEProjectNavigationViewController alloc] initWithRootViewController:viewController];
navigationController.navigationBar.barStyle = UIBarStyleBlack;
   //iOS 6
   if ([self respondsToSelector:@selector(presentViewController:animated:completion:)])
       [self presentViewController:navigationController animated:YES completion:NULL];
   else
       [self presentModalViewController:navigationController animated:YES];
}

崩溃日志将右花括号显示为导致崩溃的行:

Incident Identifier: F261ECD3-29DF-4360-B5AB-6C1DD0906D6A
CrashReporter Key:   cce2db7ca2a68093009446fb47f71ea8c3991922
Hardware Model:      iPhone4,1
Process:         MagicEye-iPhone [855]
Path:            /var/mobile/Applications/1D9D4CB5-FA72-41A5-B9A7-D44BBB2417E2/MagicEye-iPhone.app/MagicEye-iPhone
Identifier:      MagicEye-iPhone
Version:         ??? (???)
Code Type:       ARM (Native)
Parent Process:  launchd [1]

Date/Time:       2013-01-07 20:14:12.348 +0000
OS Version:      iPhone OS 5.1 (9B179)
Report Version:  104

Exception Type:  EXC_CRASH (SIGABRT)
Exception Codes: 0x00000000, 0x00000000
Crashed Thread:  0

Last Exception Backtrace:
0   CoreFoundation                  0x378eb88f 0x37832000 + 759951
1   libobjc.A.dylib                 0x35df1259 0x35de8000 + 37465
2   CoreFoundation                  0x378eb789 0x37832000 + 759689
3   CoreFoundation                  0x378eb7ab 0x37832000 + 759723
4   UIKit                           0x3427e639 0x33f94000 + 3057209
5   UIKit                           0x3427e7a7 0x33f94000 + 3057575
6   UIKit                           0x3427e50f 0x33f94000 + 3056911
7   UIKit                           0x3420f0ed 0x33f94000 + 2601197
8   UIKit                           0x3417d4b3 0x33f94000 + 2004147
9   UIKit                           0x3405ae01 0x33f94000 + 814593
10  UIKit                           0x33fd0dbf 0x33f94000 + 249279
11  UIKit                           0x33ff5629 0x33f94000 + 398889
12  UIKit                           0x33fb9d7d 0x33f94000 + 155005
13  UIKit                           0x3407c4dd 0x33f94000 + 951517
14  UIKit                           0x33fc255d 0x33f94000 + 189789
15  UIKit                           0x33fc240b 0x33f94000 + 189451
16  UIKit                           0x3407c4a3 0x33f94000 + 951459
17  UIKit                           0x34031873 0x33f94000 + 645235
18  UIKit                           0x340311b7 0x33f94000 + 643511
19  UIKit                           0x3407ad89 0x33f94000 + 945545
20  UIKit                           0x340794eb 0x33f94000 + 939243
21  MagicEye-iPhone                 0x00069e21 -[MEMainViewViewController_iPhone projectButtonPressed:] (MEMainViewViewController_iPhone.m:203)
22  CoreFoundation                  0x378453fd 0x37832000 + 78845
23  UIKit                           0x33fb2faf 0x33f94000 + 126895
24  UIKit                           0x33fb2f6b 0x33f94000 + 126827
25  UIKit                           0x33fb2f49 0x33f94000 + 126793
26  UIKit                           0x33fb2cb9 0x33f94000 + 126137
27  UIKit                           0x33fb35f1 0x33f94000 + 128497
28  UIKit                           0x33fb1ad3 0x33f94000 + 121555
29  UIKit                           0x33fb14c1 0x33f94000 + 120001
30  UIKit                           0x33f9783d 0x33f94000 + 14397
31  UIKit                           0x33f970e3 0x33f94000 + 12515
32  GraphicsServices                0x3274f22b 0x3274a000 + 21035
33  CoreFoundation                  0x378bf523 0x37832000 + 578851
34  CoreFoundation                  0x378bf4c5 0x37832000 + 578757
35  CoreFoundation                  0x378be313 0x37832000 + 574227
36  CoreFoundation                  0x378414a5 0x37832000 + 62629
37  CoreFoundation                  0x3784136d 0x37832000 + 62317
38  GraphicsServices                0x3274e439 0x3274a000 + 17465
39  UIKit                           0x33fc5e7d 0x33f94000 + 204413
40  MagicEye-iPhone                 0x00028937 main (main.m:16)
41  MagicEye-iPhone                 0x000288d0 start + 40


Thread 0 name:  Dispatch queue: com.apple.main-thread
Thread 0 Crashed:
0   libsystem_kernel.dylib          0x35d6a32c 0x35d59000 + 70444
1   libsystem_c.dylib               0x31eb8208 0x31e6b000 + 315912
2   libsystem_c.dylib               0x31eb1298 0x31e6b000 + 287384
3   libc++abi.dylib                 0x354bdf64 0x354b7000 + 28516
4   libc++abi.dylib                 0x354bb346 0x354b7000 + 17222
5   libobjc.A.dylib                 0x35df1350 0x35de8000 + 37712
6   libc++abi.dylib                 0x354bb3be 0x354b7000 + 17342
7   libc++abi.dylib                 0x354bb44a 0x354b7000 + 17482
8   libc++abi.dylib                 0x354bc81e 0x354b7000 + 22558
9   libobjc.A.dylib                 0x35df12a2 0x35de8000 + 37538
10  CoreFoundation                  0x37841506 0x37832000 + 62726
11  CoreFoundation                  0x37841366 0x37832000 + 62310
12  GraphicsServices                0x3274e432 0x3274a000 + 17458
13  UIKit                           0x33fc5e76 0x33f94000 + 204406
14  MagicEye-iPhone                 0x00028930 main (main.m:16)
15  MagicEye-iPhone                 0x000288c8 start + 32

Thread 1 name:  Dispatch queue: com.apple.libdispatch-manager
Thread 1:
0   libsystem_kernel.dylib          0x35d5a3a8 0x35d59000 + 5032
1   libdispatch.dylib               0x34b44f04 0x34b41000 + 16132
2   libdispatch.dylib               0x34b44c22 0x34b41000 + 15394

Thread 2:
0   libsystem_kernel.dylib          0x35d6acd4 0x35d59000 + 72916
1   libsystem_c.dylib               0x31e73f36 0x31e6b000 + 36662
2   libsystem_c.dylib               0x31e73cc8 0x31e6b000 + 36040

Thread 3:
0   libsystem_kernel.dylib          0x35d6acd4 0x35d59000 + 72916
1   libsystem_c.dylib               0x31e73f36 0x31e6b000 + 36662
2   libsystem_c.dylib               0x31e73cc8 0x31e6b000 + 36040

Thread 4 name:  WebThread
Thread 4:
0   libsystem_kernel.dylib          0x35d5a004 0x35d59000 + 4100
1   libsystem_kernel.dylib          0x35d5a1fa 0x35d59000 + 4602
2   CoreFoundation                  0x378bf3ec 0x37832000 + 578540
3   CoreFoundation                  0x378be124 0x37832000 + 573732
4   CoreFoundation                  0x3784149e 0x37832000 + 62622
5   CoreFoundation                  0x37841366 0x37832000 + 62310
6   WebCore                         0x335010f0 0x33458000 + 692464
7   libsystem_c.dylib               0x31e7972e 0x31e6b000 + 59182
8   libsystem_c.dylib               0x31e795e8 0x31e6b000 + 58856

Thread 5 name:  com.apple.CFSocket.private
Thread 5:
0   libsystem_kernel.dylib          0x35d6a570 0x35d59000 + 71024
1   CoreFoundation                  0x378c363a 0x37832000 + 595514
2   libsystem_c.dylib               0x31e7972e 0x31e6b000 + 59182
3   libsystem_c.dylib               0x31e795e8 0x31e6b000 + 58856

Thread 0 crashed with ARM Thread State:
    r0: 0x00000000    r1: 0x00000000      r2: 0x00000001      r3: 0x00000000
    r4: 0x00000006    r5: 0x3edc8d98      r6: 0x00000002      r7: 0x2fe24a58
    r8: 0x00000000    r9: 0x00000000     r10: 0x3f560f60     r11: 0x00000024
    ip: 0x00000148    sp: 0x2fe24a4c      lr: 0x31eb820f      pc: 0x35d6a32c
  cpsr: 0x00000010

有什么提示吗?

4

1 回答 1

1

终于用 iOS 5.1 模拟器找到了答案:自动布局!

*** Terminating app due to uncaught exception 'NSInvalidUnarchiveOperationException', reason: 'Could not instantiate class named NSLayoutConstraint'

尽管将目标的部署目标设置为 4.3,但我没有收到任何编译器警告/错误,说明自动布局当然仅适用于 iOS 6。当您选择 nib 中的视图并设置时,您只会收到编译器错误再次在 Document Versioning 下部署到 iOS 4.3。相当混乱。

于 2013-01-08T07:36:29.063 回答