So what happens is when the app goes to the background it goes to a link and copies it's HTML contents. After that it keeps checking that page until the contents are not true. Although what happens is it says it's false even though it's not. I used some break points to check and the two values are indeed the same. I'm not sure why it's not working. Here's the code.
- (void)applicationWillResignActive:(UIApplication *)application {
// Sent when the application is about to move from active to inactive state. This can occur for certain types of temporary interruptions (such as an incoming phone call or SMS message) or when the user quits the application and it begins the transition to the background state.
// Use this method to pause ongoing tasks, disable timers, and invalidate graphics rendering callbacks. Games should use this method to pause the game.
NSURL *urll = [NSURL URLWithString:@"http://ift.tt/2daMPug"];
NSString *content1 = [NSString stringWithContentsOfURL:urll encoding: NSStringEncodingConversionAllowLossy error:nil];
while (_GO == true)
{
NSURL *urlll = [NSURL URLWithString:@"http://ift.tt/2daMPug"];
NSString *content = [NSString stringWithContentsOfURL:urlll encoding: NSStringEncodingConversionAllowLossy error:nil];
sleep(3);
if (content1 != content) {
UILocalNotification *localNotification = [[UILocalNotification alloc] init];
localNotification.fireDate = [[NSDate alloc]initWithTimeIntervalSinceNow:1];
localNotification.alertBody = @"New Little Hoot To Read!";
[[UIApplication sharedApplication] scheduleLocalNotification:localNotification];
_GO = false;
}
}}
Aucun commentaire:
Enregistrer un commentaire