Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我正在开发一个聊天应用程序,用户可以在其中发送和接收消息。我是通过推送通知完成的。我将所有消息存储在表中,因此当用户选择联系人时我会显示所有发送和接收消息。默认情况下,推送通知会发出声音应用程序已关闭。如何在应用程序打开时添加哔声。
didReceiveRemoteNotification为此使用委托:
didReceiveRemoteNotification
- (void)application:(UIApplication *)application didReceiveRemoteNotification:(NSDictionary *)userInfo { if ( application.applicationState == UIApplicationStateActive ) { //create an audio player and play the sound } }