a.使用gcd
//切换到线程中执行
dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^{
// Do the work in background
[[MyManager shareInstance] myMethod];
});
b.使用performSelectorInBackground方法
[self performSelectorInBackground:@selector(myMethod:)
withObject:myObj];
对应的原始方法:- (void)myMethod:(id)myObj;
其中方式a适应性强......
阅读全文