我在ios中制作了一个计步器程序。我希望它可以在后台工作,但我发现它会终止中断。所以我添加一个AVAudioPlayer并在后台播放沉默音乐并且它工作正常。
现在我想提交到App Store。我担心我会被拒绝。有人告诉我某事吗?如果这种方法不起作用,我怎样才能在后台运行计步器?
(ps)我需要支持没有M7
的设备
答案 0 :(得分:2)
是的,你会被拒绝。你不能这样做,只是为了让你的应用程序在后台运行。这就像将您的应用程序声明为VOIp应用程序一样,这样您就可以运行后台进程。
我建议你有一个合法的功能,需要后台处理,否则你的申请将被拒绝。
查看this link并搜索标题UIBackgroundModes以查看6个UIBackgroundMode键:
UIBackgroundModes (Array - iOS) specifies that the app provides specific background services and must be allowed to continue running while in the background. These keys should be used sparingly and only by apps providing the indicated services. Where alternatives for running in the background exist, those alternatives should be used instead. For example, apps can use the signifiant location change interface to receive location events instead of registering as a background location app.
如果您在应用程序中使用某些位置服务,我确实可以让您的应用程序在后台运行。然后,很可能,您可以在位置的密钥下注册您的应用程序:
The app provides location-based information to the user and requires the use of the standard location services (as opposed to the significant change location service) to implement this feature.