- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
我一直在许多应用程序中使用 -performSelectorInBackground
,有点忘记了 -detachNewThreadSelector
。现在我想知道两者之间有什么区别。它们是否几乎可以互换,或者是否存在差异以及其中一种优于另一种的地方?谢谢!
最佳答案
它们是相同的。请参阅documentation .
performSelectorInBackground:withObject:调用该方法的效果与以当前对象、选择器和参数对象为参数调用 NSThread 的 detachNewThreadSelector:toTarget:withObject: 方法的效果相同。
关于iphone - [NSThread detachNewThreadSelector :] and -performSelectorInBackground 之间的区别,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/2092526/
我正在开发一个 iphone 应用程序,我在其中提取 RSS 提要然后解析它们。我的代码如下所示: - (void)viewDidAppear:(BOOL)animated { [super
我知道 分离新线程选择器:toTarget:withObject 可以有一个 (id)anArgument。我已经搜索过它可以用于 NSString。 但是,当我传递一个整数或 size_t 时,它崩
我正在开发一个由其他人设计的应用程序。该应用程序充满了这样的调用: [NSThread detachNewThreadSelector:@selector(loadPhotoImage) toTarg
我正在努力每 60 秒在后台执行一些任务。后台任务是服务器请求从网站下载文件。当请求完成并且我正在将数据保存到 sqlite 时,主线程/UI 似乎正在锁定。 NSAutoreleasePool *p
我一直在许多应用程序中使用 -performSelectorInBackground,有点忘记了 -detachNewThreadSelector。现在我想知道两者之间有什么区别。它们是否几乎可以互换
少数客户在我的 OS X 应用程序中遇到了以下挂起日志签名的挂起: 26 ??? [0x7fff93e87fc9] 26 ??? [0x7fff93e8372a] 26 ??? [0x7fff93
我正在使用 detachNewThreadSelector 创建一个新线程 ref使用 toTarget self. 该线程的目的是轮询运动并根据需要加载图像 - 它循环并仅在主线程中的原子 bool
我需要执行异步函数执行,因为它阻塞了主线程,因此 UI 不可用。 看了stackoverflow的题目,知道了异步函数的三种方式。 一个例子: [NSThread detachNewThreadSel
该应用程序在 iOS 7 中正常运行,但当我疯狂地切换到 iOS 8 时,该应用程序无法按预期方式运行。在 Debug模式下,调用应用程序中的 NSThread detachNewThreadSele
我正在使用 block 在异步调用中下载图像。我知道如何以这种方式使用 block [self getimage:url block:^(UIImage *img) { passblock
在 NSThread 文档中,我遇到了方法 detachNewThreadSelector:toTarget:withObject:。该方法与使用 initWithTarget:selector:ob
您好,我正在使用 [NSThread detachNewThreadSelector:toTarget:withObject:] 并且我遇到了很多内存泄漏,因为我没有为分离线程设置自动释放池。我只是想
我对 Objective C 语法还很陌生,所以我可能会让这个变得过于复杂,但我似乎无法弄清楚如何将 NSTimeInterval 传递给线程。 我想启动一个休眠 x 秒的线程,从主线程发送参数如下:
它们似乎执行相当相似的任务:启动一个新线程来快速轻松地执行该选择器。但有什么区别吗?也许与内存管理有关? 最佳答案 两者是相同的。 在 iOS 和 Mac OS X v10.5 及更高版本中,所有对象
我有一个 C++ 类方法,我需要用所有参数调用“detachNewThreadSelector”方法。 这就是问题所在,因为我的类(class)不是 Objective-C 我没有自指针。我也不知道如
我是一名优秀的程序员,十分优秀!