I am using https://github.com/st3fan/iphone-bitly classes and as the example i want to do something for which i want your help.
- (void) demo
{
URLShortener* shortener = [[URLShortener new] autorelease];
if (shortener != nil) {
shortener.delegate = self;
shortener.login = @"LOGIN-REPLACE-ME";
shortener.key = @"KEY-REPLACE-ME";
shortener.url = [NSURL URLWithString: @"http://stefan.arentz.ca"];
[shortener execute];
///// I want to get result on here not in the delegate for further usage in my function
}
}
any help or suggestion
What you’re requesting would block the current thread. If you ran that on the main thread, you’d hang your app. The framework you’ve linked only provides an asynchronous interface for that reason.
If you’re already running this on a background thread, you can re-implement
executeto use[NSURLConnection sendSynchronousRequest:returningResponse:error:]. But never run that on your main thread.