Note that there are some explanatory texts on larger screens.

plurals
  1. POHow to call a function in applicationDidEnterBackground?
    primarykey
    data
    text
    <p>I want to call a function in <code>applicationDidEnterBackground</code> this function is defined in other controller.</p> <p>I have made an object to access it but it seems that function is getting killed when called.</p> <p>Here is the function it basically calculates the distance and postes a notification</p> <pre><code> -(void)calculateDistance { for (NSMutableDictionary *obj in placeName) { CLLocation *userLocation = [[AppHelper appDelegate] mLatestLocation]; CLLocation *annotation1 = [[CLLocation alloc] initWithLatitude:[[obj objectForKey:@"Lat"]doubleValue] longitude:[[obj objectForKey:@"long"]doubleValue]]; CGFloat distanceTemp = [annotation1 getDistanceFrom:userLocation]; [obj setObject:[NSNumber numberWithFloat:distanceTemp] forKey:@"distance"]; [annotation1 release]; } if ([placeName count]) { NSArray *sortedArray=[placeName sortedArrayUsingFunction:intSort context:NULL]; self.placeName = [NSMutableArray arrayWithArray:sortedArray]; NSMutableArray *arrayTemp = [[NSMutableArray alloc] initWithArray:placeName]; for (int i =0; i &lt; [placeName count]; i++) { // NSArray *sortedArray=[placeName sortedArrayUsingFunction:intSort context:NULL]; NSMutableArray *tempArray = [sortedArray objectAtIndex:i]; //DLog(@"sortedArray%@", sortedArray);8= NSNumber *DistanceNum = [tempArray objectForKey:@"distance"]; NSLog(@"distance%@:::",DistanceNum); NSInteger intDistance = (int)[DistanceNum floatValue]; if(intDistance&lt;500) { NSLog(@"ho gaya bhai"); NSString *notifications =@"Yes"; [[AppHelper mDataManager] setObject:notifications forKey:@"notifications"]; NSLog(@"notifications:%@",notifications); RemindMeViewController *object = [[RemindMeViewController alloc] initWithNibName:@"RemindMeViewController" bundle:nil]; // RemindMeViewController *object=[[RemindMeViewController alloc]initWithNibName]; NSLog(@"notifications set"); [object scheduleNotification]; } else { // [arrayTemp removeObjectAtIndex:i]; } } //after for loop is ended self.placeName= arrayTemp; DLog(@"remaining",arrayTemp); [arrayTemp release]; [mTableView reloadData]; } } </code></pre>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload