Why does my iPhone app crash after re-opening it? - iphone

I created an iPhone app with XCode and Phonegap.
Launching the app works perfectly fine but when I press the home button of the iPhone (which puts the app into the background) and then open the app again (to bring it to foreground), it crashes.
This is what the logs say:
2012-10-31 14:37:21.359 [810:907] -[AppDelegate myFunc]: unrecognized
selector sent to instance 0x1e064220
2012-10-31 14:37:21.361 [810:907] --- Terminating app due to uncaught
exception 'NSInvalidArgumentException', reason: '-[AppDelegate
myFunc]: unrecognized selector sent to instance 0x1e064220'
--- First throw call stack:
(0x361b62a3 0x344c697f 0x361b9e07 0x361b8531 0x3610ff68 0x36107037
0x33bc9d91 0x37630213 0x3762fdff 0x37487d61 0x374876d5 0x37487123
0x3663a5a3 0x3618b683 0x3618aee9 0x36189cb7 0x360fcebd 0x360fcd49
0x366392eb 0x374db301 0xe7c89 0xe7c20)
libc++abi.dylib: terminate called throwing an exception
The image attached shows the line of code where it stops.
What's going on?

It appears you're invoking a method called myFunc that doesn't exist on your AppDelegate.
This will cause the application to terminate. Check that function exists or remove the invokation.
When you bring an app from the background to the foreground, different methods are invoked on the delegate, so your call to MyFunc might exist there.
Check
applicationDidBecomeActive
and
applicationWillEnterForeground
The details of this can be found here:
http://developer.apple.com/library/ios/#documentation/iPhone/Conceptual/iPhoneOSProgrammingGuide/ManagingYourApplicationsFlow/ManagingYourApplicationsFlow.html

I might be wrong, did you add some logic in
- (void)applicationWillEnterForeground:(UIApplication *)application
- (void)applicationDidBecomeActive:(UIApplication *)application
And there is something you have released? And also did you check with this?-[AppDelegate myFunc]

Related

UIPopoverController and UISplitView in iOS 5.1 -> unknown function: _presentPopoverBySlidingIn:

I canĀ“t find nothing about:
UIPopoverController _presentPopoverBySlidingIn:fromEdge:ofView:animated:stateOnly:notifyDelegate:
I got following error message:
*** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[UIPopoverController _presentPopoverBySlidingIn:fromEdge:ofView:animated:stateOnly:notifyDelegate:]: Popovers cannot be presented from a view which does not have a window.'
I start my iPad-App in Portrait-Mode. And because I need some steps to be done from the master-VC, I present the Popover-Controller programmatically via
[ _masterPopoverController presentPopoverFromBarButtonItem:self.navigationItem.leftBarButtonItem permittedArrowDirections:UIPopoverArrowDirectionAny animated:NO];
When I want to dismiss the Popover manually (via touch or swipe outside the popover), the above error occurs.
The problem exists since iOS 5.1.

NSDictionary objectForKey IPhone simulator and IPhone device

I have this function return [remoteObject objectForKey:key]; which should return an object that is in my dictionary.
When I am starting the Iphone simulator everything is fine and it returns the right object.
But when I am starting the same application an my device my application crashes and it says SIGABRT
and
2011-12-05 10:25:17.601 iPhoneXMPP[242:1a1f] -[CALayer objectForKey:]:
unrecognized selector sent to instance 0x4f3d40 2011-12-05
10:25:17.602 iPhoneXMPP[242:1a1f] * Terminating app due to uncaught
exception 'NSInvalidArgumentException', reason: '-[CALayer
objectForKey:]: unrecognized selector sent to instance 0x4f3d40'
My key is an Id (17) and it is also in my dictionary.
Does anybody of you knows why this happens only on my device?
It means that your remoteObjectobject is being deallocated somewhere. Usually autoreleases happen faster on the device because it has less memory than the simulator that's why on the simulator your object is still there when you are trying to call it's method. Make sure you call retainon your object when you created it and release when you are done with it.

TabbarController crashes in 3.0

i am using TabBarController , it is working fine in my ipod.
but my application is crashing it 3.0 . any help please?
self.window.rootViewController = self.tabBarController; //crashing here
and log shows
-[UIWindow setRootViewController:]: unrecognized selector sent to instance 0x127c80
Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '*** -
[UIWindow setRootViewController:]: unrecognized selector sent to instance 0x127c80'
This may show you the right direction. Let me know if the problem still continues.
Due to executing on different versions of iOS, that method may have deprecated.
The crash is because you're calling a method that doesn't exist, not because your variables are not initialized.
-setRootViewController doesn't exist prior to iOS 4.0. Use
[self.window addSubview:self.tabBarController.view];
instead.
Or, update your target platfor to 4.0.2 or later. It's probably less than 5% of users that aren't using iOS 4 at this point.

Universal app iPad version IBAction throwing NSInvalidArgumentException unrecognized selector

For some reason I cannot figure out I have an IBAction code wired up to fire on the touchupinside for a UIButton on a view using Interface Builder. Simple stuff right?? Well it works fine in my iphone version but for some reason I keep getting the following error when I click on the button in the iPad even though I have it wired up properly. IB has the the correct class name for files owner, it's wired to the action. I've checked and double checked my connections, rewired them from scratch, cleaned classes, deleted the app from the simulator and googled to the end of the internets.
Why would this be any different between ipad and iphone version? Can someone please help me before I go insane on something that should be working but just refuses to work???? Even weirder it seems whatever I try to wire up to an action is throwing a similar error. I'm starting to think Interface Builder is just crazy or something.
2010-08-15 14:19:13.372 AppName[28524:207] * -[UIViewController doClick]: unrecognized selector sent to instance 0x4d7fac0
2010-08-15 14:19:13.373 AppName[28524:207] * Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '*** -[UIViewController doClick]: unrecognized selector sent to instance 0x4d7fac0'
UIViewController doesn't respond to doClick: which is what you are seeing here.
In the nib file for your view, have you set the "File's Owner" to the class that you inherit from UIViewController and contains the doClick: method?

Xcode iPhone SDK "Terminating app due to uncaught exception"

I have a problem with my application for the iPhone.
It's a tab based application. In one of the tabs, I have a Table View. I have set it up to load in data from a PLIST.
My problem is that when I try to build and run it, the application either crashes, or stays at a black screen with the error message "Terminating app due to uncaught exception".
I looked in the console, and found that the error probably laid in this string:
- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section
{
return workouts.count;
}
(error message:)
2010-02-06 21:50:54.733 Mudo[52439:207] *** -[FirstViewController tableView:numberOfRowsInSection:]: unrecognized selector sent to instance 0x39101a0
2010-02-06 21:50:54.735 Mudo[52439:207] *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '*** -[FirstViewController tableView:numberOfRowsInSection:]: unrecognized selector sent to instance 0x39101a0'
2010-02-06 21:50:54.736 Mudo[52439:207] Stack: (
29344859,
2569487625,
29726779,
29296246,
29148866,
4413562,
4420938,
4419935,
3136474,
3076985,
3118420,
3106975,
55857840,
55857263,
55855302,
55854394,
2780921,
2804616,
2787027,
2814133,
37441233,
29129600,
29125704,
2780777,
2818051
)
Building the app does not generate any errors.
Please help me? Thanks :)
If you look at the actual text of the exception, 'NSInvalidArgumentException', reason: '*** -[FirstViewController tableView:numberOfRowsInSection:]: unrecognized selector sent to instance 0x39101a0', you can see the root of the problem. Somewhere in your code you're calling tableView:numberOfRowsInSection: on a FirstViewController, which doesn't implement that method.
Exceptions are not caught at compile-time, but rather thrown at runtime. You may want to read up on them if you aren't familiar, as they're a fairly important part of many programming languages.
http://en.wikipedia.org/wiki/Exception_handling
I'm guessing, since FirstViewController is one of the standard example classes created when starting a new Tab Bar based application in Xcode that you haven't changed its super class or implemented the methods of UITabeViewDelegate and UITableViewDataSource.
Either that or you've implemented the methods from those protocols in another class, but set FirstViewController as the table view's delegate/datasource.
We need more information to know for sure.