cocoa - pass local declaration of NSDictionary to performSelector -



cocoa - pass local declaration of NSDictionary to performSelector -

how not need set info object right in selector phone call method?

code warning (local declaration of data) :

nsdictionary *data = [nsdictionary dictionarywithobjectsandkeys:@"siluetaimage", @"action", silueta_id, @"siluetaid", siluetatyp_id, @"siluetatypid", nil]; [self performselector:@selector(downloadbindatafortyp:data:) withobject:@"siluetaimage" withobject:data];

code without warning :

[self performselector:@selector(downloadbindatafortyp:data:) withobject:@"siluetaimage" withobject:[nsdictionary dictionarywithobjectsandkeys:@"siluetaimage", @"action", silueta_id, @"siluetaid", siluetatyp_id, @"siluetatypid", nil]];

the selector:

- (void)downloadbindatafortyp:(nsstring *)typ data:(nsdictionary*)data { asinetworkqueue *q = [self queue]; nsstring *surl = @"url_web_service"; asihttprequest *request = [asihttprequest requestwithurl:[nsurl urlwithstring:surl]]; nsstring *msglength = [nsstring stringwithformat:@"%d", [[self getmsg] length]]; [request settimeoutseconds:60]; [request addrequestheader: @"content-type" value:@"text/xml; charset=utf-8"]; [request addrequestheader: @"soapaction" value:_action]; [request addrequestheader: @"content-length" value:msglength]; [request setrequestmethod: @"post"]; request.userinfo = data; [request appendpostdata:[self getmsg]]; [request setdelegate:self]; [q addoperation:request]; [q go]; }

nsdictionary *data = [nsdictionary dictionarywithobjectsandkeys:@"siluetaimage", @"action", silueta_id, @"siluetaid", siluetatyp_id, @"siluetatypid", nil]; [self performselector:@selector(downloadbindatafortyp:data:) withobject:@"siluetaimage" withobject:data];

in passing data scope method. , outside method can not accessed, getting released.

cocoa nsdictionary selector

Comments

Popular posts from this blog

web services - java.lang.NoClassDefFoundError: Could not initialize class net.sf.cglib.proxy.Enhancer -

Accessing MATLAB's unicode strings from C -

javascript - mongodb won't find my schema method in nested container -