2010-04-16 2 views
0

저는 Eric Czarny의 Cocoa XML-RPC 프레임 워크를 사용하여 Wordpress API를 호출하고 있습니다. 좋은 예제를 제공하는 Wordpress에서 샘플 앱을 다운로드했습니다. 불행히도 좋은 예는 wp.newComment를 제외한 모든 호출에 대한 것입니다.Objective C에서 Wordpress XML-RPC 호출 : 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", @"[email protected]", @"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]); 
} 

답변

0

wp.newComment의 예제가없는 예제 Wordpress 소스 코드의 구버전을 다운로드했음을 발견했습니다.

더 많은 예제가있는 소스 코드의 훨씬 새로운 버전을 찾을 수 있습니다. 나는 내 문제를 해결 할 수 있었다 새로운 코드에서 예제를 사용

http://iphone.trac.wordpress.org/browser

.