CKNotificationInfo soundName不起作用

时间:2015-08-16 09:27:18

标签: ios cloudkit

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

也行不通

1 个答案:

答案 0 :(得分:0)

也需要更新registerUserNotificationSettings方法调用。

UIApplication.sharedApplication().registerUserNotificationSettings(UIUserNotificationSettings(forTypes: .Sound | .Alert, categories: nil))