开发者

Objectiveflickr set properties, more than one call

I cant to set Meta and set Location in ObjectiveFlickr

if I do only one it works fine, but if I do both it only does the first one

- (void)flickrAPIRequest:(OFFlickrAPIRequest *)inRequest didCompleteWithResponse:(NSDictionary *)inResponseDictionary

{ NSLog(@"%s %@ %@", PRETTY_FUNCTION, inRequest.sessionInfo, inResponseDictionary);

if (inRequest.sessionInfo == kUploadImageStep) {
    snapPictureDescriptionLabel.text = @"Setting properties...";


    NSLog(@"%@", inResponseDictionary);
    NSString *photoID = [[inResponseDictionary valueForKeyPath:@"photoid"] textContent];

    flickrR开发者_StackOverflow中文版equest.sessionInfo = kSetImagePropertiesStep;
    [flickrRequest callAPIMethodWithPOST:@"flickr.photos.setMeta" arguments:[NSDictionary dictionaryWithObjectsAndKeys:photoID, @"photo_id", @"Snap and Run", @"title", @"Uploaded from my iPhone/iPod Touch", @"description", nil]];        
    flickrRequest.sessionInfo = kSetImagePropertiesStep;
    [flickrRequest callAPIMethodWithPOST:@"flickr.photos.geo.setLocation" arguments:[NSDictionary dictionaryWithObjectsAndKeys:photoID, @"photo_id",@"34" ,@"lat",@"-118",@"lon", nil]];                        



}
else if (inRequest.sessionInfo == kSetImagePropertiesStep) {
    [self updateUserInterface:nil];     
    snapPictureDescriptionLabel.text = @"Done";

    [UIApplication sharedApplication].idleTimerDisabled = NO;       

}

}


You need to define a new step (for example: NSString *kSetImageGeoInfoStep = @"kSetImageGeoInfoStep") and set the sessionInfo to this new step by adding an additional condition in the if/else if block to accommodate the geo info update. The code should look something like this (disclaimer - not compiled so syntax error are possible:

if (inRequest.sessionInfo == kUploadImageStep) {
    snapPictureDescriptionLabel.text = @"Setting properties...";


    NSLog(@"%@", inResponseDictionary);
    NSString *photoID = [[inResponseDictionary valueForKeyPath:@"photoid"] textContent];
    [photoID retain];

    flickrRequest.sessionInfo = kSetImagePropertiesStep;
    [flickrRequest callAPIMethodWithPOST:@"flickr.photos.setMeta" arguments:[NSDictionary dictionaryWithObjectsAndKeys:photoID, @"photo_id", @"Snap and Run", @"title", @"Uploaded from my iPhone/iPod Touch", @"description", nil]];            

}
else if (inRequest.sessionInfo == KSetImagePropertiesStep) {
    snapPictureDescriptionLabel.text = @"Setting Geo info..."; 
    flickrRequest.sessionInfo = kSetImageGeoInfoStep;
    [flickrRequest callAPIMethodWithPOST:@"flickr.photos.geo.setLocation" arguments:[NSDictionary dictionaryWithObjectsAndKeys:photoID, @"photo_id",@"34" ,@"lat",@"-118",@"lon", nil]];                        
}
else if (inRequest.sessionInfo == kSetImageGeoInfoStep) {
    [self updateUserInterface:nil];     
    snapPictureDescriptionLabel.text = @"Done";
    [photoID release];
    photoID = nil;

    [UIApplication sharedApplication].idleTimerDisabled = NO;       

}
0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜