我在Objective -c中使用NSRails :
NSError *error;
posts = [NSMutableArray arrayWithArray:[Post remoteAll:&error]];
NSLog(@"%@", posts);
我要回来了:
2013-10-07 22:03:11.377 MyBlog[19411:303] [NSRails][OUT] ===> GET to http://localhost:3000/posts
2013-10-07 22:03:11.813 MyBlogr[19411:303] (
"<Post: 0x101a0eb80>"
)
我将如何把这样的东西"<Post: 0x101a0eb80>"
变成普通的 JSON?
这很奇怪,因为当我去http://localhost:3000/posts.json
(或没有分机。“.json”)时,我得到了这个:
{
id: 1,
created_at: "2013-10-06T22:18:24.219Z",
updated_at: "2013-10-06T22:18:24.219Z",
galleries: [
{
id: 1,
name: "my gallery",
user_id: 1,
post_id: 1,
created_at: "2013-10-06T22:20:54.446Z",
updated_at: "2013-10-06T22:20:54.446Z"
},