connectWithUserName must be called from the main thread only?

0 votes
Is there any limitation demanding that connectWithUserName must be called from from the main thread only? I am working on a project for iOS. I had connectWithUserName called from the main thread and it worked fine until I moved this call to a background thread. Immediately onConnectDone stopped to get triggered and further calls to AppWarp client return CONNECTION_ERR. Can you please comment on this? Thank you.
asked Sep 22, 2014 in AppWarp by ilya (22 points)

1 Answer

+1 vote
 
Best answer
Hi ilya,

For now it will only run from main thread. We made this as it is an Async call and will not block the main thread so there is no harm if you call it from main thread.

Can you please give us some more details like the scenario due to which you need to call it from background thread.

Thanks.
answered Sep 23, 2014 by rajeev.etc (1,660 points)
selected Sep 23, 2014 by ilya
Thank you for your reply. I was calling connectWithUserName from a background thread because it is a part of login function. In this login function both App42 and AppWarp calls are made. Basically I fetch data from App42 storage service to get user ID and then call connectWithUserName using this ID as a name. Since App42 calls are blocking I have to run them in a background thread and I expected I could call connectWithUserName from the same thread. In fact this can be easily solved by forcing connectWithUserName to be executed in the main thread (performSelectorOnMainThread). I just wanted to check if this is expected behavior.
Download Widgets
Welcome to ShepHertz Product line forum, where you can ask questions and receive answers from the community. You can also reach out to us on support@shephertz.com
...