3
GCM
私のiosアプリケーションにリンゴプッシュ通知を送信するには、正常に機能しているが音が出ない通知を送信しています。
どうすればこの問題を解決できますか?
これは、以下の私のコードです:Swiftのリモート通知からの音声がありません
func application(application: UIApplication, didFinishLaunchingWithOptions launchOptions: [NSObject: AnyObject]?) -> Bool {
// Override point for customization after application launch.
// Preloads keyboard so there's no lag on initial keyboard appearance.
let lagFreeField:UITextField = UITextField();
self.window?.addSubview(lagFreeField);
lagFreeField.becomeFirstResponder();
lagFreeField.resignFirstResponder();
lagFreeField.removeFromSuperview();
locationManager = CLLocationManager()
locationManager?.requestWhenInUseAuthorization()
var configureError:NSError?
GGLContext.sharedInstance().configureWithError(&configureError)
assert(configureError == nil, "Error configuring Google services: \(configureError)")
gcmSenderID = GGLContext.sharedInstance().configuration.gcmSenderID
if #available(iOS 8.0, *) {
let settings: UIUserNotificationSettings =
UIUserNotificationSettings(forTypes: UIUserNotificationType.Sound.union(UIUserNotificationType.Alert), categories: nil)
application.registerUserNotificationSettings(settings)
application.registerForRemoteNotifications()
} else {
let settings = UIUserNotificationSettings(forTypes: [.Alert, .Badge, .Sound], categories: nil)
UIApplication.sharedApplication().registerUserNotificationSettings(settings)
UIApplication.sharedApplication().registerForRemoteNotifications()
}
let gcmConfig = GCMConfig.defaultConfig()
gcmConfig.receiverDelegate = self
GCMService.sharedInstance().startWithConfig(gcmConfig)
return true
}