ios - UIActionSheet Crashing when using XCode 5 -


in iphone app displaying simple uiactionsheet , working correctly on xcode 4.6 , want migrate app xcode 5.

but when moved xcode 5, app crashing when showing action sheet.

i using iphone 4 ios 7 test on both

this action sheet code (i removed part of try narrow down issue)

uiactionsheet *languagemessage = [[uiactionsheet alloc] initwithtitle:@"title" delegate:nil cancelbuttontitle:@"cancel" destructivebuttontitle:nil otherbuttontitles:nil];  languagemessage.actionsheetstyle=uiactionsheetstyleblacktranslucent; [languagemessage showinview:self.view];  

the app crashing (sigabrt) on line

[languagemessage showinview:self.view];  

while debugging self.view not null , read correctly not issue

this stack trace

* thread #1: tid = 0x19cd1e, 0x3860f688 libobjc.a.dylib`objc_exception_throw, queue = 'com.apple.main-thread, stop reason = breakpoint 35.1 frame #0: 0x3860f688 libobjc.a.dylib`objc_exception_throw frame #1: 0x30bd8bc6 uikit`-[uiactionsheet _assertifvalidforview:] + 190 frame #2: 0x30c403b4 uikit`-[uiactionsheet showinview:] + 164 frame #3: 0x00126cac bassara`-[rootloginviewcontroller showlanguagesheet](self=0x165ba810, _cmd=0x00371c48) + 444 @ rootloginviewcontroller.m:84 frame #4: 0x00126ac6 bassara`-[rootloginviewcontroller viewdidload](self=0x165ba810, _cmd=0x30ffef84) + 774 @ rootloginviewcontroller.m:68 frame #5: 0x309f737a uikit`-[uiviewcontroller loadviewifrequired] + 518 frame #6: 0x309f7138 uikit`-[uiviewcontroller view] + 24 frame #7: 0x309fde04 uikit`-[uiwindow addrootviewcontrollerviewifpossible] + 64 frame #8: 0x309fb4da uikit`-[uiwindow _sethidden:forced:] + 306 frame #9: 0x30a6608c uikit`-[uiwindow makekeyandvisible] + 60 frame #10: 0x30a62e58 uikit`-[uiapplication _callinitializationdelegatesforurl:payload:suspended:] + 1656 frame #11: 0x30a5d352 uikit`-[uiapplication _runwithurl:payload:launchorientation:statusbarstyle:statusbarhidden:] + 714 frame #12: 0x309f841e uikit`-[uiapplication handleevent:withnewevent:] + 3130 frame #13: 0x309f7720 uikit`-[uiapplication sendevent:] + 72 frame #14: 0x30a5cb3c uikit`_uiapplicationhandleevent + 664 frame #15: 0x32e9370c graphicsservices`_purpleeventcallback + 608 frame #16: 0x32e932f6 graphicsservices`purpleeventcallback + 34 frame #17: 0x2e24a9de corefoundation`__cfrunloop_is_calling_out_to_a_source1_perform_function__ + 34 frame #18: 0x2e24a97a corefoundation`__cfrunloopdosource1 + 346 frame #19: 0x2e24914e corefoundation`__cfrunlooprun + 1398 frame #20: 0x2e1b3c26 corefoundation`cfrunlooprunspecific + 522 frame #21: 0x2e1b3a0a corefoundation`cfrunloopruninmode + 106 frame #22: 0x30a5bdd8 uikit`-[uiapplication _run] + 760 frame #23: 0x30a57048 uikit`uiapplicationmain + 1136 frame #24: 0x00044e80 bassara`main(argc=1, argv=0x27dc3cf4) + 116 @ main.m:16  thread #2: tid = 0x19cd41, 0x38bbb83c libsystem_kernel.dylib`kevent64 + 24, queue = 'com.apple.libdispatch-manager frame #0: 0x38bbb83c libsystem_kernel.dylib`kevent64 + 24 frame #1: 0x38b06e0c libdispatch.dylib`_dispatch_mgr_invoke + 232 frame #2: 0x38af63a2 libdispatch.dylib`_dispatch_mgr_thread$variant$up + 38  thread #3: tid = 0x19cd43, 0x38bcec7c libsystem_kernel.dylib`__workq_kernreturn + 8 frame #0: 0x38bcec7c libsystem_kernel.dylib`__workq_kernreturn + 8 frame #1: 0x38c34dca libsystem_pthread.dylib`_pthread_wqthread + 310 frame #2: 0x38c34c84 libsystem_pthread.dylib`start_wqthread + 8  thread #4: tid = 0x19cd48, 0x38bcec7c libsystem_kernel.dylib`__workq_kernreturn + 8 frame #0: 0x38bcec7c libsystem_kernel.dylib`__workq_kernreturn + 8 frame #1: 0x38c34dca libsystem_pthread.dylib`_pthread_wqthread + 310  thread #5: tid = 0x19cd5c, 0x38bcec7c libsystem_kernel.dylib`__workq_kernreturn + 8 frame #0: 0x38bcec7c libsystem_kernel.dylib`__workq_kernreturn + 8 frame #1: 0x38c34dca libsystem_pthread.dylib`_pthread_wqthread + 310 

what might causing crash on xcode 5 , not on xcode 4.6

thank help.

frame #3: 0x00126cac bassara`-[rootloginviewcontroller showlanguagesheet](self=0x165ba810, _cmd=0x00371c48) + 444 @ rootloginviewcontroller.m:84 frame #4: 0x00126ac6 bassara`-[rootloginviewcontroller viewdidload](self=0x165ba810, _cmd=0x30ffef84) + 774 @ rootloginviewcontroller.m:68 

you seem creating , showing uiactionsheet in viewdidload method view created. there fair chance view referred through self.view not created.

you should move showlanguagesheet call viewdidappear method instead. if want display action sheet once when view controller created/displayed hold simple bool flag , set after displaying action sheet.

something like,

-(void) viewdidappear {     if(!isactionsheetshown) {         [self showlanguagesheet];         isactionsheetshown = yes;     } } 

Comments

Popular posts from this blog

android - Get AccessToken using signpost OAuth without opening a browser (Two legged Oauth) -

org.mockito.exceptions.misusing.InvalidUseOfMatchersException: mockito -

google shop client API returns 400 bad request error while adding an item -