我希望能找到一些帮助来深入了解 Podiokit,即 Podio 的 ObjC-API。我尝试将链接字段的值设置为 URL。我的第一个简单尝试如下所示:
NSDictionary *embedAttributes = [NSDictionary dictionaryWithObject: @"http://www.google.com" forKey: @"url"];
PKTEmbed *embed = [[PKTEmbed alloc] initWithDictionary: embedAttributes];
item[@"linkfield"] = embed;
我找到了一个使用 PHP 的示例,但没有运气将其转换为 Objective-C:
$attributes = array( 'url' => 'http://www.infranet.com' );
$embed = PodioEmbed::create( $attributes );
$attribute['embed']['embed\_id'] = $embed->embed\_id;
$attribute['file']['file\_id'] = $embed->files[0]->file\_id;
$this->orgItem->field('organizationlink')->set\_value($attribute);
也许有人知道如何做对,会很好:-)
[编辑] PodioKit 手册只是说:
PKTEmbed *link = ...;
item[@"link"] = link;
[编辑 2] 当我尝试保存项目时发生错误。日志说:
Error: Saving file Error Domain=com.alamofire.error.serialization.response Code=-1011 "Request failed: Ungültige Anforderung (400)" UserInfo=0x600000c7ee80 {com.alamofire.serialization.response.error.response=<NSHTTPURLResponse: 0x6000008358e0> { URL: https://api.podio.com/item/app/_xxxx_/ } { status code: 400, headers {
"Content-Length" = 263;
"Content-Type" = "application/json; charset=utf-8";
Date = "Sat, 27 Sep 2014 19:16:22 GMT";
Server = nginx;
"X-Podio-Request-Id" = yqyl6yku;
"X-Rate-Limit-Limit" = 250;
"X-Rate-Limit-Remaining" = 248;
} }, NSLocalizedDescription=Request failed: Ungültige Anforderung (400), NSErrorFailingURLKey=https://api.podio.com/item/app/_xxxx_/}
谢谢,迈克尔/汉堡