简体   繁体   English

在iOS中,在后台上传照片超过10分钟

[英]Upload photos in background for more than 10 minutes in iOS

I have an iPhone application which needs to upload photos when the application is in background. 我有一个iPhone应用程序,需要在应用程序处于后台时上传照片。 Currently I am using the beginBackgroundTask method in applicationDidEnterBackground . 目前我在applicationDidEnterBackground中使用beginBackgroundTask方法。 Using this approach, my application continues to upload photos for 10 minutes in background and then gets suspended. 使用这种方法,我的应用程序继续在后台上传照片10分钟,然后暂停。 But my requirement is to continue uploading in background even after the value of backgroundTimeRemaining becomes zero. 但我的要求是,即使后backgroundTimeRemaining的值变为零,继续在后台上传。

The Microsoft SkyDrive app just does the same thing and it turns out that they are using ' music ' as ' background mode ' in info.plist . Microsoft SkyDrive应用程序也做了同样的事情,事实证明他们在info.plist中使用' music '作为' 后台模式 '。 But I didn't find any music file in the application bundle. 但我没有在应用程序包中找到任何音乐文件。 Any idea how they are accomplishing this task ? 知道他们是如何完成这项任务的吗?

I have already tried to play silent music when application goes to background. 当应用程序进入后台时,我已经尝试过播放静音。 But with this, the iOS shows media volume instead of ringer volume when I use the volume control key. 但是,当我使用音量控制键时,iOS会显示媒体音量而不是铃声音量。

Any suggestions how my app can upload photos in background for more than 10 minutes ? 我的应用程序如何在后台上传照片超过10分钟的任何建议?

创建NSURLSessionUploadTask以在后台上传您的内容。

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

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