ios - Separate Storyboards for iPhone 4 and iPhone 5 Cause Crash in Simulator Only -


i have 2 storyboards setup in project, 1 iphone 4 , 1 iphone 5.

i have setup code switch storyboards in - (bool)application:(uiapplication *)application didfinishlaunchingwithoptions:(nsdictionary *)launchoptions follows:

  cgsize iosdevicescreensize = [[uiscreen mainscreen] bounds].size;      if (iosdevicescreensize.height == 480)     {         // instantiate new storyboard object using storyboard file named storyboard_iphone4         uistoryboard *storyboard_iphone4 = [uistoryboard storyboardwithname:@"storyboard_iphone4" bundle:nil];          // instantiate initial view controller object storyboard         uiviewcontroller *initialviewcontroller = [storyboard_iphone4 instantiateinitialviewcontroller];          // instantiate uiwindow object , initialize screen size of ios device         self.window = [[uiwindow alloc] initwithframe:[[uiscreen mainscreen] bounds]];          // set initial view controller root view controller of window object         self.window.rootviewcontroller  = initialviewcontroller;          // set window object key window , show         [self.window makekeyandvisible];     }      if (iosdevicescreensize.height >= 568)     {   // iphone 5 , ipod touch 5th generation: 4 inch screen         // instantiate new storyboard object using storyboard file named main         uistoryboard *main2 = [uistoryboard storyboardwithname:@"main2" bundle:nil];          uiviewcontroller *initialviewcontroller = [main2 instantiateinitialviewcontroller];         self.window = [[uiwindow alloc] initwithframe:[[uiscreen mainscreen] bounds]];         self.window.rootviewcontroller  = initialviewcontroller;         [self.window makekeyandvisible];     }     else     {         uistoryboard *main2 = [uistoryboard storyboardwithname:@"main2" bundle:nil];         uiviewcontroller *initialviewcontroller = [main2 instantiateinitialviewcontroller];         self.window = [[uiwindow alloc] initwithframe:[[uiscreen mainscreen] bounds]];         self.window.rootviewcontroller  = initialviewcontroller;         [self.window makekeyandvisible];     } 

i receive following error when running on simulator (iphone 4 , iphone 5 devices work , switch storyboards expected):

thread 1: exc_bad_access (code=2, address=0xc)

this occurs here:

int main(int argc, char * argv[]) {     @autoreleasepool {         return uiapplicationmain(argc, argv, nil, nsstringfromclass([appdelegate class]));     } } 

i working in xcode 5 currently.

here trace (not sure if did correctly):

libobjc.a.dylib`objc_msgsend: 0x260e0a4:  movl   0x8(%esp), %ecx 0x260e0a8:  movl   0x4(%esp), %eax 0x260e0ac:  testl  %eax, %eax 0x260e0ae:  je     0x260e110                 ; objc_msgsend + 108 0x260e0b0:  movl   (%eax), %edx 0x260e0b2:  movzwl 0xc(%edx), %eax 0x260e0b6:  andl   %ecx, %eax 0x260e0b8:  shll   $0x3, %eax 0x260e0bb:  addl   0x8(%edx), %eax 0x260e0be:  cmpl   (%eax), %ecx 0x260e0c0:  jne    0x260e0c5                 ; objc_msgsend + 33 0x260e0c2:  jmpl   *0x4(%eax) 0x260e0c5:  cmpl   $0x0, (%eax) 0x260e0c8:  je     0x260e119                 ; objc_msgsend + 117 0x260e0ca:  cmpl   0x8(%edx), %eax 0x260e0cd:  je     0x260e0d9                 ; objc_msgsend + 53 0x260e0cf:  subl   $0x8, %eax 0x260e0d2:  cmpl   (%eax), %ecx 0x260e0d4:  jne    0x260e0c5                 ; objc_msgsend + 33 0x260e0d6:  jmpl   *0x4(%eax) 0x260e0d9:  movzwl 0xc(%edx), %eax 0x260e0dd:  shll   $0x3, %eax 0x260e0e0:  addl   0x8(%edx), %eax 0x260e0e3:  jmp    0x260e0f2                 ; objc_msgsend + 78 0x260e0e5:  cmpl   $0x0, (%eax) 0x260e0e8:  je     0x260e119                 ; objc_msgsend + 117 0x260e0ea:  cmpl   0x8(%edx), %eax 0x260e0ed:  je     0x260e0f9                 ; objc_msgsend + 85 0x260e0ef:  subl   $0x8, %eax 0x260e0f2:  cmpl   (%eax), %ecx 0x260e0f4:  jne    0x260e0e5                 ; objc_msgsend + 65 0x260e0f6:  jmpl   *0x4(%eax) 0x260e0f9:  pushl  %ebp 0x260e0fa:  movl   %esp, %ebp 0x260e0fc:  pushl  $0x0 0x260e0fe:  pushl  $0x0 0x260e100:  pushl  $0x0 0x260e102:  pushl  %edx 0x260e103:  pushl  %ecx 0x260e104:  movl   0x8(%ebp), %ecx 0x260e107:  pushl  %ecx 0x260e108:  calll  0x25fc720                 ; objc_msgsend_corrupt_cache_error 0x260e10d:  nopl   (%eax) 0x260e110:  xorl   %edx, %edx 0x260e112:  xorps  %xmm0, %xmm0 0x260e115:  xorps  %xmm1, %xmm1 0x260e118:  ret     0x260e119:  movl   0x8(%esp), %ecx 0x260e11d:  movl   0x4(%esp), %eax 0x260e121:  pushl  %ebp 0x260e122:  movl   %esp, %ebp 0x260e124:  subl   $0xc, %esp 0x260e127:  pushl  %edx 0x260e128:  pushl  %ecx 0x260e129:  pushl  %eax 0x260e12a:  calll  0x260606f                 ; _class_lookupmethodandloadcache3 0x260e12f:  leave   0x260e130:  cmpl   %eax, %eax 0x260e132:  jmpl   *%eax 

so based on image of console crash because message sent deallloced instance. can see right lldb() says [_uidelayedpresentationcontext delayingcontroller] message sent dealloced instance

i'm wondering devices crashes on in simulator - crash on both 3.5 , 4 inch devices?

one thing pops out me first if statement kicks off process create uiwindow , uinavigationcontroller along storyboard_iphone4 storyboard. after have if-else same thing different storyboard. if device not 4 inch device end creating window twice , i'm wondering if somehow that's source of crash. if remove first if statement change things?


Comments

Popular posts from this blog

google api - Incomplete response from Gmail API threads.list -

Installing Android SQLite Asset Helper -

Qt Creator - Searching files with Locator including folder -