Objectiveflickr设置属性,多个调用

时间:2010-03-22 03:06:36

标签: iphone flickr

我无法设置Meta并在ObjectiveFlickr中设置位置

如果我只做一个它可以正常工作,但如果我这两个都做了它只做第一个

- (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];

    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]];        
    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;       

}

}

1 个答案:

答案 0 :(得分:1)

您需要定义一个新步骤(例如:NSString * kSetImageGeoInfoStep = @“kSetImageGeoInfoStep”)并通过在if / else if块中添加附加条件来将sessionInfo设置为此新步骤,以适应地理信息更新。代码看起来应该是这样的(免责声明 - 没有编译,所以语法错误是可能的:

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;       

}