[英]NSString to NSArray
我得到以下值作為字符串格式。
getcommands=(
{
"created_time" = "2011-01-18T10:44:14+0000";
from = {
id = 100001511725982;
name = "ABC Welcomes U";
};
id = "100001511725982_158433587542247_1658635";
message = Nice;
},
{
"created_time" = "2011-01-18T10:44:22+0000";
from = {
id = 100001511725982;
name = "ABC Welcomes U";
};
id = "100001511725982_158433587542247_1658637";
message = "Gud One";
}
)
現在,我僅需要從此字符串中獲取““ Message””。
將此值傳遞給json類,您將獲得它的字典格式,然后使用此方法從中獲取消息
[[[dict valueforkey:@“ getcommands”] objectatindex:indexpath.row] valueforkey:@“ message”];
NSString * urlStr = [NSString stringWithFormat:@“ http://apple.com/reviewxml.php?show=Jfield”];
NSURLRequest *request = [[NSURLRequest alloc] initWithURL:[NSURL URLWithString:[urlStr stringByAddingPercentEscapesUsingEncoding:NSUTF8StringEncoding]]];
NSString *json = [BKAPIClient handleConnection:request];
[request release];
if (json)
return (NSMutableDictionary *)[json JSONValue];
return nil;
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.