Reputation: 552
I am developing an application in which i am using location service.
Basically that app show that if u get any missed call at which place.
For this i have use core-location and core telephony frame works. But when i am testing app then location service not working in background. I have use this code for didfinishlaunching.
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions{
UILocalNotification *localNotif = [launchOptions objectForKey:UIApplicationLaunchOptionsLocalNotificationKey];
if (localNotif)
application.applicationIconBadgeNumber = localNotif.applicationIconBadgeNumber-1;
locationManager = [[CLLocationManager alloc] init];
locationManager.delegate = self;
locationManager.distanceFilter = kCLDistanceFilterNone; // whenever we move
locationManager.desiredAccuracy = kCLLocationAccuracyHundredMeters; // 100 m
[locationManager startUpdatingLocation];
[self callinbackground];
[self.window makeKeyAndVisible];
return YES;
}
and app goes in background then i have write down code form this link:- code
But when app goes in background then not working. How i fixed it?
Thanks in advance...
Upvotes: 1
Views: 329
Reputation: 8053
try this:- add key in info.plist
key>UIBackgroundModes</key>
<array>
<string>location</string>
</array>
Upvotes: 2