like qik.com , ustream.com , I hope to know how to upload file in background via iPhone SDK 3.0 . Pls let me know . Thanks !
相关问题
- CALayer - backgroundColor flipped?
- Core Data lightweight migration crashes after App
- What is the best way to do a search in a large fil
- How can I implement password recovery in an iPhone
- how do you prevent page scroll in textarea on mobi
相关文章
- Could I create “Call” button in HTML 5 IPhone appl
- What is the correct way to declare and use a FILE
- Unable to process app at this time due to a genera
- How do you detect key up / key down events from a
- “Storyboard.storyboard” could not be opened
- Making new files automatically executable?
- Open iOS 11 Files app via URL Scheme or some other
- Can keyboard of type UIKeyboardTypeNamePhonePad be
It's not clear what you mean by "in background", but if you just mean you want to upload asynchronously, you can use NSURLConnection, NSURLRequest, or you can use this excellent library called ASIHTTPRequest. It works great and provides a simple way to show download and upload progress.
If you're refering to background upload while app is not running, you can't (OS doesn't allow it). If it's background while app is running, links and sample code posted here work just fine.
You can start a new thread for your file upload, look into the NSThread class heres a link http://developer.apple.com/iphone/library/documentation/Cocoa/Reference/Foundation/Classes/NSThread_Class/Reference/Reference.html ...that said you can also use asynchronousRequest from NSURLConnection which starts a thread for you heres a reference http://developer.apple.com/iphone/library/documentation/Cocoa/Reference/Foundation/Classes/NSURLConnection_Class/Reference/Reference.html
See this post for one (very well thought-out) response.
While it's not possible to upload files in the background when your app is NOT running, it's entirely possible to do so when your app IS running. This way you don't affect your foreground thread, plus you can likely augment this to show progress, etc.
You could do it this way (this is basically cut & paste from one of my projects). Credit goes to some post on the development forums, but I don't know who it was from anymore: