首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >iphone-bitly问题

iphone-bitly问题
EN

Stack Overflow用户
提问于 2011-07-28 21:30:17
回答 1查看 94关注 0票数 0

我正在使用https://github.com/st3fan/iphone-bitly类,作为示例,我想做一些需要您帮助的事情。

代码语言:javascript
复制
- (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
   }
}

任何帮助或建议

EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2011-07-28 21:41:09

你请求的东西会阻塞当前线程。如果你在主线程上运行它,你会挂起你的应用程序。由于这个原因,您链接的框架只提供了一个异步接口。

如果你已经在后台线程上运行它,你可以重新实现execute来使用[NSURLConnection sendSynchronousRequest:returningResponse:error:]。但是千万不要在你的主线程上运行它。

票数 1
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/6859751

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档