I have a simple app that allows people to upload pictures to a server. For some reason, while it’s uploading each file the app freezes and won’t allow you to do anything else on it.
Is there anyway to run it in the background?
Thanks.
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
On either iOS or Mac OS, you could handle that in a separate thread using NSThread, NSOperation, or libDispatch (on iOS 4 or Mac OS 10.6). There’s also pthreads, though I’m not sure whether that’s available on iOS. For more information, you might want to check this other question (which is aimed at iOS apps, but I think could apply equally well to Mac OS).
Edit (response to comment): The simplest way (or I guess my preferred way, maybe it’s not so simple, or even a good idea) would probably be to use libDispatch and something like this:
Whether or not this is a correct way to do things, I don’t know. You would have to do further research for that (again, refer to the other question I pointed out above). Also, I’m not sure if that code is entirely correct, since I just wrote it up in a text editor without running it through a compiler.