Discussion Forums  >  Plugins, Customizing, Source Code

Replies: 4    Views: 240

Angry Ninja
Aspiring developer
Profile
Posts: 1045
Reg: Aug 25, 2013
Maine
17,150
07/08/14 08:19 AM (10 years ago)

App Crashing When Restoring From Background?

I have a strange error in my app. When I send it to the background, then bring it back up, it crashes every time. The offending code is being reported from BT_Core > main.m and is this part here: ---------------------------------------------------------------------- int main(int argc, char *argv[]){ //return prizecasino_appDelegate as UIApplicationMain... @autoreleasepool{ int retVal = UIApplicationMain(argc, argv, @"UIApplication", @"prizecasino_appDelegate"); return retVal; } } The error log basically says that retVal is coming back null (I think)... here is the log: ------------------------------------------------------------------------ 2014-07-08 11:11:56.152 prizecasino[49001:60b] *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '*** -[__NSCFString stringByReplacingOccurrencesOfString:withString:options:range:]: nil argument' *** First throw call stack: (0x2ff41f0b 0x3a6d8ce7 0x2ff41e4d 0x3086b0b1 0x3086b05d 0xb9dcd 0xe858f 0xe6f07 0x327efddd 0x329779f5 0x32776613 0x32775df9 0x327da405 0x34de3b55 0x34de373f 0x2ff0c847 0x2ff0c7e3 0x2ff0afaf 0x2fe75769 0x2fe7554b 0x34de26d3 0x327d4891 0x9d415 0x3abd6ab7) libc++abi.dylib: terminating with uncaught exception of type NSException (lldb) I'm not sure why, but it only happens if a user is logged in to my app, using David Books Login Screen plugin. If they are logged out, it doesnt crash when coming back from the background. Same with the refresh button... same crash error if I refresh while the user is logged in. Fine if not logged in, on the same screen. Any ideas where to trace the issue? Happens on all screens, even with different plugins being used for those screens. EDIT: Still can't figure it out, but got more info using Chris1's debugging document (located here: https://www.buzztouch.com/files/howtos/exception%20debugging%20how-to.pdf ) Now it says that the issue is here, in BT_Strings.m: -------------------------------------------- //user ret = [ret stringByReplacingOccurrencesOfString:@"[userId]" withString:[appDelegate.rootUser userId]]; ret = [ret stringByReplacingOccurrencesOfString:@"[userEmail]" withString:[appDelegate.rootUser userEmail]]; ret = [ret stringByReplacingOccurrencesOfString:@"[userLogInId]" withString:[appDelegate.rootUser userLogInId]]; ret = [ret stringByReplacingOccurrencesOfString:@"[userLogInPassword]" withString:[appDelegate.rootUser userLogInPassword]]; //device ret = [ret stringByReplacingOccurrencesOfString:@"[deviceId]" withString:[appDelegate.rootDevice deviceId]]; ret = [ret stringByReplacingOccurrencesOfString:@"[deviceLatitude]" withString:[appDelegate.rootDevice deviceLatitude]]; ret = [ret stringByReplacingOccurrencesOfString:@"[deviceLongitude]" withString:[appDelegate.rootDevice deviceLongitude]]; ret = [ret stringByReplacingOccurrencesOfString:@"[deviceModel]" withString:[appDelegate.rootDevice deviceModel]]; }//root app.. [BT_debugger showIt:self message:[NSString stringWithFormat:@"mergeBTVariablesInString (after merge): %@", ret]]; it crashes on the very first instance of user, when it tries to define ret for the userid. Only happens when logged in and either refreshing or entering back from background.
 
Angry Ninja
Aspiring developer
Profile
Posts: 1045
Reg: Aug 25, 2013
Maine
17,150
like
07/08/14 08:59 AM (10 years ago)
It looks like this format of a line causes the issue: ret = [ret stringByReplacingOccurrencesOfString:@"[userId]" withString:[appDelegate.rootUser userId]]; Is it because when we download a project with the login screen plugin, we have to change the 6 instances of ".rootapp.rootuser" to just ".rootuser" to get it to compile? Is that affecting the line above? It doesn't use .rootapp, so I wouldn't think so, but it's the only thing I can think of
 
Angry Ninja
Aspiring developer
Profile
Posts: 1045
Reg: Aug 25, 2013
Maine
17,150
like
07/08/14 05:37 PM (10 years ago)
Was a json issue with the login script. All sorted now. Thanks Cakebit and PSMDanny!
 
ridgerock
Veteran developer
Profile
Posts: 183
Reg: May 19, 2011
Louisville
1,830
like
07/29/14 02:17 PM (10 years ago)
Angry Ninja, I think I have the same issue. Can you advise on you fixed it?
 
Angry Ninja
Aspiring developer
Profile
Posts: 1045
Reg: Aug 25, 2013
Maine
17,150
like
07/30/14 08:23 AM (10 years ago)
Hi Ridgerock, There was a small issue with the wordpress plugin script, where it wasn't feeding all of the required JSON data. Cakebit helped detect and fix the issue, and we sent it to PSMDanny to update his wordpress plugin, which I believe he has done, but in case you still have the old file, I PM'd you the updated code. I don't want to post it here because his plugin is only one .php file, and would be easy for people with ill notions to steal the code from here and use it without buying it proper from PSMDanny.
 

Login + Screen Name Required to Post

pointerLogin to participate so you can start earning points. Once you're logged in (and have a screen name entered in your profile), you can subscribe to topics, follow users, and start learning how to make apps like the pros.