Reputation: 359
I need to have some Alarm-Clock Functionality in my App.
One of them should be to let the Phone playing Sound when the LocalNotification fires and the App is in the Background.
With iOS 7.1 everything works fine but in iOS8 no Sound is playing anymore until the App is back in Foreground.
At the Moment i'm using the AudioToolbox/AudioServices.h
Class.
How can i fix that ?
Upvotes: 0
Views: 1807
Reputation: 177
.caf fine doesn't play with local notification on real device. If you change .caf to .aiff you'll notification with sound!
Upvotes: 0
Reputation: 359
It seems to be a bug within Xcode Simulator for iOS8. With Xcode Simulator for iOS7.1 AND/OR iOS8 "real" Device everything works fine.
Upvotes: 1
Reputation: 2474
This code may be help you...
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{
[application registerUserNotificationSettings:[UIUserNotificationSettings settingsForTypes:UIUserNotificationTypeAlert|UIUserNotificationTypeBadge|UIUserNotificationTypeSound categories:nil]]
return YES;
}
func application(application: UIApplication, didFinishLaunchingWithOptions launchOptions: NSDictionary?) -> Bool
{
application.registerUserNotificationSettings(UIUserNotificationSettings(forTypes: UIUserNotificationType.Sound|UIUserNotificationType.Alert |UIUserNotificationType.Badge, categories: nil)
return true
}
Upvotes: 2