'NSInvocationOperation' is unavailable in Xcode 6.1

Deadly 提交于 2019-12-05 09:32:37

As of Xcode 6.1, NSInvocation is disabled in Swift, therefore, NSInvocationOperation is disabled too. See this thread in Developer Forum

Because it's not type-safe or ARC-safe. Even in Objective-C it's very very easy to shoot yourself in the foot trying to use it, especially under ARC. Use closures/blocks instead.

You have to use NSBlockOperation in Swift.

or addOperationWithBlock to NSOperationQueue

queue.addOperationWithBlock { [weak self] in
    self?.backgroundRun(self)
    return
}
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!