Question

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 after 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.

...

Was it helpful?

Solution

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

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top