ios - iOS7 background fetch? -
ios - iOS7 background fetch? -
in app want send info server using ios 7 background fetch feature.i selected background fetch check box in capabilities section of target(and of course of study flag added in plist automatically).
in appdelegate did :
- (bool)application:(uiapplication *)application didfinishlaunchingwithoptions:(nsdictionary *)launchoptions { [application setminimumbackgroundfetchinterval:uiapplicationbackgroundfetchintervalminimum]; //[application setminimumbackgroundfetchinterval:10]; tried homecoming yes; }
and in delegate method did this:
-(void)application:(uiapplication *)application performfetchwithcompletionhandler:(void (^)(uibackgroundfetchresult))completionhandler{ locationmanager = [[cllocationmanager alloc] init]; locationmanager.delegate = self; locationmanager.desiredaccuracy = kcllocationaccuracybest; locationmanager.distancefilter = 50.0; [locationmanager startupdatinglocation]; /** new info exists , processed **/ if (yes) { completionhandler(uibackgroundfetchresultnewdata); } else completionhandler(uibackgroundfetchresultfailed); }
then connected iphone xcode , ran app , click simulate background fetch debug menu. delegate method called , location updated on server 1 time never happened again, scheme never wakes app in background. i'm doing wrong? help appreciated.
edit: possible send info on server using background fetch? edit-2 if utilize remote notification instead background fetch send info on server in case guaranteed scheme wake app 1 time got remote notification?
simple reply phone call performfetchwithcompletionhandler method depends on ios of device when phone call it. had same issue long , found out called in few min or hours or day or week too. ** uiapplicationbackgroundfetchintervalminimum** doesn't mean phone call in minimum time ,its never or minimum @ end depend on os create phone call preformfetch method. @ end wait os create phone call performfetchwithcompletionhandler method.
ios objective-c cllocationmanager ios7.1
Comments
Post a Comment