开发者

ASIHTTPRequest swallows up my NSOperation variables in synchronous mode

Hey I have been battling with this problem for a while now. Perhaps there is something I am missing in knowledge about multi threading but here is what happens. When I create an nsoperation queue any variables that are allocated become cleared afte开发者_如何学Cr the "[request startSynchronous];" line of code. Here is what I'm talking about:

@implementation imageLoadOperation
@synthesize object;

-(id)initWithObject:(NSMutableArray *)receivedObject
{
 ...
 object = receivedObject;
 ...
}
- (void)main {
 ...
//send request
 printf("retreiving photo info from server\n");

 NSURL *url = [NSURL URLWithString:[siteUrl stringByAppendingString:@"/connect.php"]];
 ASIFormDataRequest *request = [ASIFormDataRequest requestWithURL:url];
 [request setPostValue:@"lookAtPhoto" forKey:@"purpose"];
 [request setRequestCookies: [ASIHTTPRequest sessionCookies]];

The object still exists here

[request startSynchronous];

Then the object disappears here!

I'm sure this has something to do with a gap in principle understanding but I have been rearranging the code for days now to no success.

...


awww gosh I can't believe it. I wasn't setting the object in the correct way to trigger the property retain. > self.object

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜