Ios XML-RPC请求Wordpress
从xmlrpc服务器响应对象中获取Ios XML-RPC请求Wordpress,ios,wordpress,xml-rpc,Ios,Wordpress,Xml Rpc,从xmlrpc服务器响应对象中获取术语中的名称(我博客文章类别的名称)的值没有问题 服务器响应: responseArray: ( { guid = "http://www.domain.com/wp/?p=12"; "post_id" = "123"; terms = ( { name = "Uncategorized"; } ); } ) 。。。使用以下几行Objective-C代码: NSMutableArray
术语中的名称
(我博客文章类别的名称)的值没有问题
服务器响应:
responseArray: (
{ guid = "http://www.domain.com/wp/?p=12";
"post_id" = "123";
terms = (
{ name = "Uncategorized"; }
);
}
)
。。。使用以下几行Objective-C代码:
NSMutableArray *responseArray = [[NSMutableArray alloc] init];
responseArray = [nodeSaveResponse object];
for(i = 0; i < responseArray.count; i++) {
NSString *postLink = [[responseArray objectAtIndex: i] valueForKey: @"guid"];
NSString *postId = [[responseArray objectAtIndex: i] valueForKey: @"post_id"];
NSMutableArray *catArray = [[NSMutableArray alloc] init];
catArray = [[responseArray objectAtIndex: i] valueForKey: @"terms"]];
NSArray *cat = [catArray valueForKey: @"name"];
NSString *myCatString = [cat objectAtIndex: 0];
}
知道我的错在哪里吗
干杯,马丁
NSString *myCatString = @"MyCategory";
NSMutableDictionary *name = [[NSMutableDictionary dictionaryWithObjectsAndKeys: myCatString, @"name", nil];
NSMutableArray *catArray = [[NSMutableArray arrayWithObject: name];
NSMutableDictionary *values = [[NSMutableDictionary alloc] init];
[values setObject: title forKey: @"post_title"];
// and so on with other values - until here everything works well
[values setObject: catArray forKey: @"terms"]; // if this line is called, the request fails
NSArray *params = [NSArray arrayWithObjects: @"1", user, pass, values, nil];
[myRequest setMethod: @"wp.newPost" withParameter: params];