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
精彩评论