开发者

unable to click button while updating current location

开发者 https://www.devze.com 2023-03-12 07:01 出处:网络
As fetching current location requires much time so i want to add cancel but开发者_StackOverflow中文版ton. But i\'m unable to click any button until it gets the current location. Any suggestions???When

As fetching current location requires much time so i want to add cancel but开发者_StackOverflow中文版ton. But i'm unable to click any button until it gets the current location. Any suggestions???


When you run things on the main thread it, can lock everything up - try getting the location using

[self performSelectorInBackground:@selector(mySelector:) withObject:objectName];

UPDATE:

You will need to make an autorelease pool for this new thread too, so as the first line in mySelector, put:

NSAutoreleasePool* pool = [[NSAutoreleasePool alloc] init];

and at the last line, put:

[pool release];

All of your other code goes in between. If you don't do this, then you'll get nasty memory problems.

0

精彩评论

暂无评论...
验证码 换一张
取 消