问题
Sbuscription is create like below. It works, but no sound generated, why? Doc says: if you specify the string default for this property, the system plays the default alert sound.
let s2 = CKSubscription(recordType: recordType, predicate: NSPredicate(format: "destination = %@", CKReference(recordID: CKRecordID(recordName: loggedInUserSettingRecordName!), action: .DeleteSelf)), options: .FiresOnRecordCreation)
s2.notificationInfo = CKNotificationInfo()
s2.notificationInfo.alertBody = " "
s2.notificationInfo.soundName = "default"
subscriptionsToSave.append(s2)
s2.notificationInfo.soundName = UILocalNotificationDefaultSoundName
also not works
回答1:
Need to update registerUserNotificationSettings
method call too.
UIApplication.sharedApplication().registerUserNotificationSettings(UIUserNotificationSettings(forTypes: .Sound | .Alert, categories: nil))
来源:https://stackoverflow.com/questions/32033589/cknotificationinfo-soundname-does-not-work