uilocalnotification

How to get local notification when app is running in Objective-C

不问归期 提交于 2019-12-12 23:28:46
问题 I am new in iOS and I am facing problem regarding to show local notification when app is running. My code is like this UILocalNotification* localNotification = [[UILocalNotification alloc] init]; localNotification.fireDate = [NSDate dateWithTimeIntervalSinceNow:0]; //Enter the time here in seconds. localNotification.alertBody = @"Message hear"; localNotification.timeZone = [NSTimeZone defaultTimeZone]; localNotification.repeatInterval = NSCalendarUnitMinute; //Repeating instructions here.

UIApplicationLaunchOptionsLocalNotificationKey always null - iOS

核能气质少年 提交于 2019-12-12 19:06:35
问题 I have an iOS application which uses local notifications. When the app is running in the background or is active, I use the application didReceiveLocalNotification methods and that works great. But when the app is closed (not running in the background), I use the application didFinishLaunchingWithOptions method to control what happens when the notification is handled. However, the problem I have is that the notification is always (null) in the didFinishLaunchingWithOptions method. Here is my

using a UILocalNotification to play a sound that's not in the app bundle

让人想犯罪 __ 提交于 2019-12-12 17:34:32
问题 Is it possible to use a UILocalNotification (or any outside notification/long-term multitasking) to play a sound outside an app that's NOT in the main application bundle? Documentation for UILocalNotification says the soundName attribute must be the name of a file in the main bundle. I threw together a quick app that confirms this. Is there a way to get around this restriction? I was thinking something with aliases, where the alias is in the app bundle and points to a known path in the

Local notification fired after deleting code

不打扰是莪最后的温柔 提交于 2019-12-12 17:23:37
问题 I am facing a weird problem with UILocalNotifiation . I was scheduling a local notification at 11:59 every night. Now, I have deleted that code from my project but I am still receiving that local notification every night at 11:59. I have tried to remove build from device, change device and clean derived data. 回答1: That's actually standard iOS behaviour, since you schedule the notifications on iOS (the actual operating system). This means, that once you scheduled a UILocalNotification , it

iPhone alarms that wake up the device from sleep with sound

眉间皱痕 提交于 2019-12-12 10:19:43
问题 I'm a bit confused on iPhone's capabilities for alarms (local notifications) and I haven't found a clear answer yet. I would like to create functionality like the alarm clock (or even new mail). Specifically, if the device is asleep, it gets waken with a buzz or sound. A popup message that you can't see (because the device is asleep) is a lot less useful. But, it seems that using the UILocalNotification service, this doesn't seem to be happening. I haven't checked out push notifications, but

Clear app badge with local notifications

倾然丶 夕夏残阳落幕 提交于 2019-12-12 07:11:34
问题 I'm trying to clear my app's "unread" badge with a UILocalNotification . Logically you would think this would be done by setting applicationIconBadgeNumber of a UILocalNotification instance to 0. But it doesn't work, and the docs for applicationIconBadgeNumber say "The default value is 0, which means "no change.”" So is there really no way to clear a badge with local notifications once it's been set? Update: Some simple code: -(void)applicationDidFinishLaunching { // Set the appication icon

Can I test local notifications on the WatchOS 2 Simulator?

孤街醉人 提交于 2019-12-12 05:24:30
问题 I am Googling a lot to find out way to check local notifications on the WatchOS Simulator because I don't have an iWatch. Right now I have implemented local notification but due some reason notification is shown on iPhone simulator but not on iWatch (WatchOS 2) simulator. I have added following code in applicationDidFinishLaunchingWithOptions: UIMutableUserNotificationAction *action1; action1 = [[UIMutableUserNotificationAction alloc] init]; [action1 setActivationMode

UILocalNotification crashes my application when I start it

喜欢而已 提交于 2019-12-12 05:20:51
问题 I can enable an UILocalNotification in my application, I proceed like this: in my UIViewController if(_endDate){ UILocalNotification *localNotif = [[UILocalNotification alloc] init]; if (localNotif == nil) return; localNotif.fireDate = _endDate; localNotif.timeZone = [NSTimeZone defaultTimeZone]; localNotif.alertBody = @"go"; localNotif.soundName = UILocalNotificationDefaultSoundName; localNotif.applicationIconBadgeNumber = 1; [[UIApplication sharedApplication] scheduleLocalNotification

Recurring Local Notification in iOS

好久不见. 提交于 2019-12-12 05:20:02
问题 I just want to ensure I understand how local notifications work. Is it true that once I run the below code one time, I'll have weekly notifications? //Goes in AppDelegate.swift func application(application: UIApplication, didFinishLaunchingWithOptions launchOptions: [NSObject: AnyObject]?) -> Bool { // Override point for customization after application launch. //Added this for notifications. //Without this, I don't believe the user gets the opportunity to approve notifications from the app

iOS: If app is in background and local notification is arrived; which method will called automatically?

只愿长相守 提交于 2019-12-12 05:08:52
问题 My problem is, if app is in background and notification arrives and I opened the app from icon ; app restores it states but I want to update the screen data in this case. Is there any way to update the data in background when notification arrives? Here is the code which I'm using for tackling this case: ViewController.m file code: - (void)viewDidLoad { [super viewDidLoad]; [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(appIsComingFromBackground:) name