Objectiveflickr设置属性,多次调用

发布于 2024-08-26 05:30:37 字数 1421 浏览 4 评论 0原文

如果我只执行一项,我无法在 ObjectiveFlickr 中设置 Meta 和设置 Location

,但如果我同时执行两项,则只执行第一个

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

}

}

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

    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;       

}

}

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

如何视而不见 2024-09-02 05:30:37

您需要定义一个新步骤(例如: 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;       

}

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;       

}
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文