CKNotificationInfo soundName不起作用
Sbuscription创建如下。 它有效,但没有声音产生,为什么? Doc说: 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
也行不通
需要更新registerUserNotificationSettings
方法调用。
UIApplication.sharedApplication().registerUserNotificationSettings(UIUserNotificationSettings(forTypes: .Sound | .Alert, categories: nil))