के गुणों को बनाए रखने/रिलीज करने के लिए यह प्रश्न ios NSError types के समान है लेकिन वहां वर्णित समाधान काम नहीं करता है और मुझे विश्वास है कि यह नहीं है काफी मुझे क्या चाहिए।'एनएसईआरआर * कॉन्स __strong *' प्रकार के पैरामीटर को 'एनएसईआरआरआर * __ ऑटोरेलीज़िंग *' के पैरामीटर को भेजना पॉइंटर
मेरे पास एक तरीका है जो एक एसिंक्रोनस कॉल करता है और फिर एक समापन ब्लॉक का आह्वान करता है।
Sending 'NSError *const __strong *' to parameter of type 'NSError *__autoreleasing *' changes retain/release properties of pointer
कोड इस प्रकार है के रूप में: मूल्य द्वारा
+(void) agentWithGUID:(NSString *) guid completion:(void (^)(AKAgentProfile * agentProfile, NSError ** error)) completionBlock
{
dispatch_queue_t requestQueue = dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0);
dispatch_async(requestQueue, ^{
NSString * parameterizedUrl = [AKAgentProfileEndPoint stringByAppendingString:guid];
NSURL *url = [NSURL URLWithString:parameterizedUrl];
NSData *data = [NSData dataWithContentsOfURL:url];
NSError * error = nil;
AKAgentProfile * agentProfile = [[[AKAgentFactory alloc] init] agentProfileWithData:data error:&error];
dispatch_async(dispatch_get_main_queue(), ^{
completionBlock(agentProfile,&error);
});
});
}
आपके पास पॉइंटर-टू-पॉइंटर बनाम पॉइंटर का अर्थ क्या है, इसकी कुछ मौलिक गलतफहमी है। – Andy
एंडी: मैं मानता हूं, मुझे ऐसा कुछ समझने में कुछ समय लगता है जो बाद में स्पष्ट हो जाता है! –