简体   繁体   English

每次启动应用程序时播放声音

[英]Play sound when each time app is launched

Is there a convenient way to play a sound when the app is launched? 启动应用程序时,是否有便捷的播放声音的方法? I want it to be played only when the app is launched, not when the app entered background and went out of a background state. 我希望在启动应用程序时播放它,而不是在应用程序进入后台并退出后台状态时播放。

Any ideas where I could put the code for this? 有什么想法可以在其中放置代码吗?

在您的应用程序委托中,该函数...

- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions

Add your sound code to 将您的声音代码添加到

- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions

That method is only called once, when the app first opens. 该方法仅在应用程序首次打开时被调用一次。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM