【发布时间】:2010-04-16 13:48:24
【问题描述】:
我正在使用 Eric Czarny 的 Cocoa XML-RPC 框架来调用 Wordpress API。我已经从 Wordpress 下载了示例应用程序,其中提供了一些很好的示例。不幸的是,除了 wp.newComment 之外,每个调用都是很好的例子。
我正在尝试使用下面的代码发表评论,但我不断收到带有本地化描述的错误,告诉我检查我的输入参数。我检查并重新检查,我不明白什么是错的。
有什么想法吗?
NSDictionary *commentStructure = [NSDictionary dictionaryWithObjectsAndKeys:[NSNumber numberWithInt:0], @"comment_parent", @"xmlrpc anonymous comments plugin now enabled", @"content", @"Test Author", @"author", @"http://iphone.someurl.com", @"author_url", @"someemailaddy@hotmail.com", @"author_email", nil];
NSArray *args = [NSArray arrayWithObjects:[NSNumber numberWithInt:0], @"", @"", [NSNumber numberWithInt:[self.parentFeedItem.postID intValue]], commentStructure, nil]; // the param(s)
NSString *server = [[[NSString alloc] initWithString:@"http://www.someurl.com/xmlrpc.php"] autorelease]; // the server
NSString *method = [[[NSString alloc] initWithString:@"wp.newComment"] autorelease]; // the method
XMLRPCRequest *request = [[XMLRPCRequest alloc] initWithHost:[NSURL URLWithString:server]];
[request setMethod:method withObjects:args];
id response = [self executeXMLRPCRequest:request];
[request release];
if( [response isKindOfClass:[NSError class]] ) {
//return nil;
NSLog(@"There was a problem");
NSLog([response localizedDescription]);
}
【问题讨论】: