CKNotificationInfo soundName does not work

不羁的心 提交于 2019-12-31 04:30:09

问题


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

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!