WARNING: Slow defaults access for key Internal took xx seconds, tolerance is 0.020000
Asked Answered
S

1

7

I have a weird problem with a phonegap iOS app. I have a version without adverts approved and working fine on the app store and a new version with adverts which has been rejected due to the app hanging on the splash screen.

The difference in the apps is 3 ad plugins, iAD, admob and revmob. The app works fine mostly but once every so often it will hang on the splash screen like the feedback from Apple suggests, I can't find what makes the problem occur.

The only clue I have is "WARNING: Slow defaults access for key Internal took 0.039977 seconds, tolerance is 0.020000" appearing in the error console but when this appears the app still runs fine.

Is this warning likely to relate to the hanging on splashscreen problem? Any ideas how to approach the problem or what to look for which might be causing it?

Thanks

Saturation answered 12/12, 2013 at 23:17 Comment(1)
Make sure you do not make any calculations before the app really starts. If it takes too long the app will be forced to crash by the operating system. If you need to do something that takes a few seconds (f.e. copy a big file the first time) do it in your first VC after viewDidLoad (or in viewDidLoad in a method called by performSelector:afterDelay:.1)Rahal
I
1

I don`t think this is the reason and you are probably getting this on the simulator which is not as efficient as the device.

The reason for late launches 90% of the times is something that you do in your app delegate, more specifically in

- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions

Avoid doing lengthy tasks in there , like network connections or manipulating large data and if you still need to do something in there and can`t move it to your viewDidLoad method do it in another thread like so:

- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{
// Override point for customization after application launch.
[self performSelectorInBackground:@selector(fetchUserInfoFromDB) withObject:nil];


return YES;
}

-(void)fetchUserInfoFromDB
{
//Do what you need to do in here
sleep(5);
NSLog(@"The app lanuched but I am still running in the background, Yay!!");

}

Best of luck

Invigorate answered 18/7, 2014 at 2:20 Comment(1)
Ops , I just noticed the PhoneGap part which I assume would generate the binary for you with you having no control of the code. Anyway , I hope my answer would help others who would face this issue when developing their apps using xcode and objective cInvigorate

© 2022 - 2024 — McMap. All rights reserved.