Objectiveflickr设置属性,多次调用
如果我只执行一项,我无法在 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 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您需要定义一个新步骤(例如: NSString *kSetImageGeoInfoStep = @"kSetImageGeoInfoStep"),并通过在 if/else if 块中添加附加条件来将 sessionInfo 设置为此新步骤以适应地理信息更新。代码应该看起来像这样(免责声明 - 未编译,因此可能存在语法错误:
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: