Simple test app with local notifications.
Code:
UILocalNotification * locNot = [[UILocalNotification alloc] init];
[locNot setAlertAction:[[NSString alloc] initWithString:@"Test Notif"]];
[locNot setAlertBody:[[NSString alloc] initWithString:@"Test Notif!!!"]];
NSDate * nsd = [NSDate dateWithTimeIntervalSinceNow:10];
[locNot setFireDate:nsd];
[[UIApplication sharedApplication] scheduleLocalNotification:locNot];
When I debug it from Xcode, it works just fine (alerts in 10 seconds).
When I put it on a Cydia repository, the app open and works fine, but is not added to NotificationCenter and does not send the alert. Has anyone encountered this before, and does anyone know if there's a solution?
When I googled around, I saw some people saying to use this in AppDelegate, but it didn't work. (This is to force the app to enable it in NotificationCenter; my alert isn't even appearing in NotificationCenter)
Code:
[[UIApplication sharedApplication]registerForRemoteNotificationTypes: UIRemoteNotificationTypeBadge |
UIRemoteNotificationTypeAlert |
UIRemoteNotificationTypeSound];
NSLog(@"Register notifications ");