-
Notifications
You must be signed in to change notification settings - Fork 148
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
delegate callback doesn't get called when call callAPIMethodWithGET #34
Comments
if (requestURL) {
[HTTPRequest setContentType:nil];
+ [HTTPRequest setShouldWaitUntilDone:YES];
return [HTTPRequest performMethod:LFHTTPRequestGETMethod onURL:requestURL withData:nil];
}
return NO; |
IOS 5.1 ARC enabled, link objectiveflickr as static library, this is how i use objectiveflickr. (most copied from the sample code) the flickrAPIRequest callback doesn't get called. - (RocoFlickrPhoto *) init {
flickrAPIContext = [[OFFlickrAPIContext alloc] initWithAPIKey:FLICKR_API_KEY sharedSecret:FLICKR_API_SHARED_SECRET];
flickrRequest = [[OFFlickrAPIRequest alloc] initWithAPIContext:flickrAPIContext];
[flickrRequest setDelegate:self];
return self;
}
- (void) flickrAPIRequest:(OFFlickrAPIRequest *)inRequest didCompleteWithResponse:(NSDictionary *)inResponseDictionary {
NSDictionary *photoDict = [[inResponseDictionary valueForKeyPath:@"photos.photo"] objectAtIndex:0];
NSString *title = [photoDict objectForKey:@"title"];
if (![title length]) {
title = @"No title";
}
NSURL *photoSourcePage = [flickrAPIContext photoWebPageURLFromDictionary:photoDict];
}
- (RocoPhoto *) getRecentPhoto {
if (![flickrRequest isRunning]) {
BOOL result = [flickrRequest callAPIMethodWithGET:@"flickr.photos.getRecent" arguments:[NSDictionary dictionaryWithObjectsAndKeys:@"1", @"per_page", nil]];
}
return nil;
} |
seems a bug of Xcode. |
not a bug of Xcode. |
Have the same issue. Thanks @MelvinTo for the |
Found a problem and a solution: a request object had been autoreleased before it received any response, so just own that request either by adding to an array or capturing it with a strong pointer and everything will be ok. It also explains why |
I was having this problem. This identified the issue. The class that was using the ObjectiveFlickr and making the API calls was held weakly within a block. Once the block finished, the instance was lost and, with it, the API call, delegate callbacks, etc. When I specified __strong __weak for that instance, it all worked again.
|
@Property (nonatomic,strong) OFFlickrAPIRequest *flickrRequest; if (requestURL) { i add this line code marked by '+' ,but the callback can not be called!! |
and if I manually set the shouldWaitUntilDone to YES before performing the http request, the callback can be called successfully.
The text was updated successfully, but these errors were encountered: