why does presentViewController:animated:completion: crash?

0

I've got a strange crash on a customers iPhone (running iOS 5.1), I have no problems at all on iOS 6 with this code:

- (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];
}

The crash log is showing the closing curly brace as the line causing the crash:

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

Any hints?

objective-c
cocoa-touch
ios5
ios6
asked on Stack Overflow Jan 7, 2013 by b00tsy • edited Jan 8, 2013 by paulmelnikow

1 Answer

1

Finally found the Answer with the iOS 5.1 Simulator: Autolayout!

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

Although the Deployment Target is set of the target is set to 4.3 I didn't get any compiler warnings / errors that Autolayout is of course only available to iOS 6. You only get the compiler error when you select the view in the nib and set the Deployment to iOS 4.3 under Document Versioning there again. Quite confusing.

answered on Stack Overflow Jan 8, 2013 by b00tsy

User contributions licensed under CC BY-SA 3.0