我使用的是 iOS 7,我的推送通知不播放声音。
Strangely, I found there is no setting for sound in the Preference > Notification Center for my app. Following is the screenshots of Notification center for my app:
以下是 Skype 的情况:
您会看到,我的应用程序没有“声音”部分。
有人可以帮忙吗?
Update:
Now I have registered sound in my app. The Notification Center now looks like:
我的通知有声音。看起来不错。
But after I enter the setting of my app, there is initially a 'Sounds' section like Skype, but then the Preference app crashed, and after that, there is no more 'Sounds', just like below:
这可能是苹果的一个bug吗?
您尚未在应用程序中注册音频推送通知。只需在您的 App Delegate 中注册即可:
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{
//Whatever you have already in your app delegate...
// Let device know you're going to be sending one of these types of notifications.
[[UIApplication sharedApplication] registerForRemoteNotificationTypes:
(UIRemoteNotificationTypeBadge | UIRemoteNotificationTypeSound | UIRemoteNotificationTypeAlert)];
return YES;
}
这 5 种类型是:
- UIRemoteNotificationTypeBadge
- UI远程通知类型声音
- UIRemoteNotificationTypeAlert
- UIRemoteNotificationType无
- UIRemoteNotificationTypeNewsstandContentAvailability
这是文档:注册远程通知 https://developer.apple.com/library/ios/DOCUMENTATION/UIKit/Reference/UIApplication_Class/Reference/Reference.html#//apple_ref/c/tdef/UIRemoteNotificationType
希望有帮助!
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)