大佬教程收集整理的这篇文章主要介绍了ios – 如何用可空写入完成块?,大佬教程大佬觉得挺不错的,现在分享给大家,也给大家做个参考。
CRASH
[KPTaxnoteApiSaveHandler saveEntryWithUuid:uuid completion:nil];
好
[KPTaxnoteApiSaveHandler saveEntryWithUuid:uuid completion:^(NSError *error) {}];
这是代码.
+ (void)saveEntryWithUuid:(NSString *)uuid completion:(void (^ __nullablE)(NSError * _Nullable error))completion { NSLog(@"saveEntryWithUuid"); Entry *entry = [Entry MR_findFirstByAttribute:@"uuid" withValue:uuid]; NSDictionary *params = @{@"entrY[uuid]":entry.uuiD}; [KPTaxnoteApiSaveHandler postWithUrl:kApiUrlStringForEntry params:params completion:^(NSError *error) { if (!error) { [MagicalRecord saveWithBlock:^(NsmanagedObjectContext *localContext) { Entry *entry = [Entry MR_findFirstByAttribute:@"uuid" withValue:uuid inContext:localContext]; entry.needSave = @NO; }]; } completion(error); }]; + (void)postWithUrl:(NSString *)urlStr params:(NSDictionary *)params completion:(nullable void (^)(NSError *_Nullable error))completion { AFhttprequestOperationManager *manager = [AFhttprequestOperationManager manager]; [manager POST:urlStr parameters:params success:^(AFhttprequestOperation *operation,id responSEObject) { completion(nil); } failure:^(AFhttprequestOperation *operation,NSError *error) { completion(error); }];
以上是大佬教程为你收集整理的ios – 如何用可空写入完成块?全部内容,希望文章能够帮你解决ios – 如何用可空写入完成块?所遇到的程序开发问题。
如果觉得大佬教程网站内容还不错,欢迎将大佬教程推荐给程序员好友。
本图文内容来源于网友网络收集整理提供,作为学习参考使用,版权属于原作者。
如您有任何意见或建议可联系处理。小编QQ:384754419,请注明来意。