json 如何在控制台 Xcode 中打印?
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/14719770/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
How to print in Console Xcode?
提问by user1951876
I am using afnetworking to parse JSON data. I want to print the data on the console.
我正在使用 afnetworking 来解析 JSON 数据。我想在控制台上打印数据。
How do i print this
我如何打印这个
self.videoMetaData = [JSON valueForKeyPath:@"data.items.video"];
i tried this
我试过这个
NSLog(@" data %@",videoMetaData);
it works when i have
当我有时它有效
NSArray *videoMetaData = [JSON valueForKeyPath:@"data.items.video"];
回答by Sebastian
As mentioned in the comments you have to use NSLog(@" data %@", self.videoMetaData);to log the data. There is no variable called videoMetaData.
如评论中所述,您必须使用NSLog(@" data %@", self.videoMetaData);来记录数据。没有变量称为videoMetaData。
Having said that, you might want to have a look how to examine objects and variables using the debugger. Have a look at this for example: http://www.cimgf.com/2012/12/13/xcode-lldb-tutorial/
话虽如此,您可能想看看如何使用调试器检查对象和变量。例如看看这个:http: //www.cimgf.com/2012/12/13/xcode-lldb-tutorial/
There are some good videos on lldb from WWDC 2012 on developer.apple.com (you have to be a registered developer in the iOS or Mac Developer Program)
developer.apple.com 上 WWDC 2012 的 lldb 上有一些不错的视频(您必须是 iOS 或 Mac 开发者计划的注册开发者)

