2015-08-16 61 views
1

Sbuscription創建如下。它工作,但沒有聲音產生,爲什麼?醫生說:if you specify the string default for this property, the system plays the default alert sound.CKNotificationInfo聲音名稱不起作用

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 

也沒有工作

回答

0

需要一併更新registerUserNotificationSettings方法調用。

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