Changing the app name causes crashes on startup
I recently changed the name of my app from ABCXYZ to ABC-XYZ in
info.plist -> Bundle Display Name
This will crash the device on startup. This is the only message:
DiskCookieStorage changing policy from 2 to 0, cookie file:
file:///private/var/mobile/Containers/Data/Application/7CB9B0EA-97A2-4D3E-A8AA-CEB419BEB1F2/Library/Cookies/Cookies.binarycookies
The simulator works fine, only real device failure. What is the problem? Will it crash when updated in the appstore?
Edit 1: Everything was working fine before I changed the name of the app. I will try to change the name to see if the problems have gone away.
Edit 2: No, it didn't work even after I changed the name. What should I do now?
Edit 3: I only change the display name of the application, not the project name or whatever. My project name is still ABCXYZ-iPad. I think the problem might be because I imported too many external frameworks, sdk ... and this is causing a conflict somewhere?
Edit 4: These are all the solutions I've tried so far. No result yet.
0. Rename to its old name, reinstall.
1. Clean, build, reset xcode, clean, build.
2. Delete app on device, reinstall.
3. Re-download from store, reinstall.
4. Reset device, reinstall.
Edit 5: I just found out that my application went through this line of code.
-(void)application:(UIApplication *)application performFetchWithCompletionHandler:(void (^)(UIBackgroundFetchResult))completionHandler {
NSLog(@"background fetch");
completionHandler(UIBackgroundFetchResultNewData);
}
And then write the message above. Not sure what that means.
EDIT 6: FOUND EXACTLY WHERE IS THIS CAUSING A RESET! Many thanks to Nicholas Langley, the issues printed here:
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{
// Stripe Payment
[Stripe setDefaultPublishableKey:StripePublishableKey];
// iZettle Payment
[[iZettleSDK shared] startWithAPIKey:@"THE_API_KEY"];
I changed the name of my application to change it. After debugging, it prints a message after this line of code (startWithAPIKey) and it fails when trying to do this:
NSMutableDictionary *dic = [[NSMutableDictionary alloc] init];
NSString *x = [[NSUserDefaults standardUserDefaults] objectForKey:@"X"];
[dic setObject:x forKey@"X"]; <<< HERE ERROR SETTING NIL. STRANGE because it doesn't print any message. Also, My app should store X already.
It looks like after changing the application name it will also change the package which will result in data loss. Now the real question is how to migrate old data with new data after app name / package change. The simulator does not produce this error, and I cannot debug in the device directory to test something.
EDIT 7: EXTERNAL SOLUTION!
After updating the app:
NSMutableDictionary *dic = [[NSMutableDictionary alloc] init];
NSString *x = [[NSUserDefaults standardUserDefaults] objectForKey:@"X"];
if (x) {
[dic setObject:x forKey@"X"];
}
And reinstall it, it will crash several times and then work fine again. I even change the name of the app a few more times, no problem whatsoever. I'm really worried if updating the app in the store crashes if users download and update the app.
EDIT 8: Test with update from repository. I just reload from the old version of the store. Then update to the new version (don't change the app name). Then change the name of the app. No problems. The problem just disappeared like a dream ....... I don't even know what to do. This meme is absolutely in my case! Well, thanks to everyone who took the time to read this long article.
source to share
-
Close Xcode and all editors.
-
Copy the project folder.
-
Create a new folder eg. Documents \ Projects \ Proj_1.
-
Insert your project files here.
-
Open Xcode, clean the solution and try reinstalling it on your device.
The problem might be your hard drive. My variation changes the location of your files, and this changes the addresses of the project files on your hard drive.
source to share