Xcode application running on Iphone but crashing on Ipad -
i made universal application contains nib files both ipad , iphone ui's. in view controllers initwithnibname method call uiuserinterfaceidiompad == ui_user_interface_idiom()
detect whether controller running on iphone or ipad.
i launch respective nib files. when run app on iphone, works fine, when run on ipad crashes exc_bad_access
error. error occurs when use view controller launch view controller, launches 1 in navigation stack. error occurs click view belongs third controller of stack.
i cannot distinguish difference between nib
files cause crash. have been working tirelessly figure out why happening cannot fix error. have insight might going on?
any advice on how approach fixing problem appreciated.
the first thing should enable "all exceptions" break point. accurately tell line of code exc_bad_access happening.
next, turn on zombies , see over-release happening. so, in xcode, while holding option key, click product | run.... in ensuing window, add nszombieenabled environment variables list.
then run. normal things cause crash , see debugger lands. luck, stop problem occurring.
when exc_bad_access means you're trying access/release that's been released. if you're in non-arc situation, means you've inadvertently released when didn't mean to, check alloc/init , release balance. if, however, you're in arc situation, bet has not niling delegate when view controller gets released.
for example, if have mkmapview , have set delegate view controller, should nil delegate when view gets unloaded or dealloc'd. otherwise, messages continue set it. or, possibility you've added view controller nsnotificationcenter observer , didn't remove observer when view controller unloaded or dealloc'd.
another possibility you're re-using view controllers between 2 versions of universal app. if accessing identifier doesn't exist in nib ipad, cause crash--though if you're using nibs opposed storyboards, may not issue.
that's can think of now. try 0 in on it's happening , post code here if still can't figure out.
best regards.
Comments
Post a Comment