youtube收件箱问题

问题描述

| 我正在尝试以编程方式(使用gdata api)从youtube帐户检索传入的消息。 我的请求:
NSURL *url = [NSURL URLWithString:@\"http://gdata.youtube.com/Feeds/api/users/my_nick/inBox\"];

NSMutableuRLRequest *inBoxRequest = [NSMutableuRLRequest requestWithURL:url];

Nsstring *authStr = [Nsstring stringWithFormat:@\"GoogleLogin auth=%@\",authMarker];

[inBoxRequest setValue:authStr forHTTPHeaderField:@\"Authorization\"];
[inBoxRequest addValue:@\"Content-Type\" forHTTPHeaderField:@\"application/x-www-form-urlencoded\"];
[inBoxRequest setHTTPMethod:@\"GET\"];

NSHTTPURLResponse *response = NULL;

NSData *responseData = [NSURLConnection sendSynchronousRequest:inBoxRequest returningResponse:&response error:nil];

Nsstring *responseDataString = [[Nsstring alloc] initWithData:responseData encoding:NSASCIIStringEncoding];

NSLog(@\"\\n%@\\n\",responseDataString);
NSLog(@\"\\n%@\\n\",[inBoxRequest ]);
返回没有条目的供稿...(尽管我可以在网站上看到传入的消息) 这是nslog的回应:
<?xml version=\'1.0\' encoding=\'UTF-8\'?><Feed xmlns=\'http://www.w3.org/2005/Atom\' xmlns:openSearch=\'http://a9.com/-/spec/opensearchRSS/1.0/\'><id>http://gdata.youtube.com/Feeds/api/users/thisistestnick/inBox</id><updated>2011-06-16T14:45:00.475Z</updated><category scheme=\'http://schemas.google.com/g/2005#kind\' term=\'http://gdata.youtube.com/schemas/2007#videoMessage\'/><title type=\'text\'>InBox of thisistestnick</title><logo>http://www.youtube.com/img/pic_youtubelogo_123x63.gif</logo><link rel=\'alternate\' type=\'text/html\' href=\'http://www.youtube.com/my_messages?folder=inBox&amp;filter=videos\'/><link rel=\'http://schemas.google.com/g/2005#Feed\' type=\'application/atom+xml\' href=\'http://gdata.youtube.com/Feeds/api/users/thisistestnick/inBox\'/><link rel=\'http://schemas.google.com/g/2005#batch\' type=\'application/atom+xml\' href=\'http://gdata.youtube.com/Feeds/api/users/thisistestnick/inBox/batch\'/><link rel=\'self\' type=\'application/atom+xml\' href=\'http://gdata.youtube.com/Feeds/api/users/thisistestnick/inBox?start-index=1&amp;max-results=25\'/><author><name>thisistestnick</name><uri>http://gdata.youtube.com/Feeds/api/users/thisistestnick</uri></author><generator version=\'2.0\' uri=\'http://gdata.youtube.com/\'>YouTube data API</generator><openSearch:totalResults>0</openSearch:totalResults><openSearch:startIndex>1</openSearch:startIndex><openSearch:itemsPerPage>25</openSearch:itemsPerPage></Feed>
怎么了?请帮助。     

解决方法

        为什么您不能使用gdata-objectivec lib api而是自己进行解析?我没有尝试检索“收件箱”,但在获取所需信息方面相当成功。使用它的优点是: a)您以本机格式(字符串和字典)获取信息,lib为您解析提要。 b)主要是,不会有任何解析/ api理解错误(我想这是您遇到问题的原因)。