小编Way*_*e3d的帖子

Xcode,为什么控制台中省略了一些NSLog条目?

我刚开始学习IOS开发.每次运行此程序时,控制台都不会始终显示我的NSLog.

#import <Foundation/Foundation.h>

int main(int argc, const char * argv[])
{

    @autoreleasepool {

        NSMutableArray *items = [[NSMutableArray alloc] init];

        [items addObject:@"One"];
        [items addObject:@"Two"];
        [items addObject:@"Three"];

        [items insertObject:@"zero" atIndex:0];

        NSLog(@"Object at 0 is %@", [items objectAtIndex:0]);
        NSLog(@"Object at 1 is %@", [items objectAtIndex:1]);
        NSLog(@"Object at 2 is %@", [items objectAtIndex:2]);
        NSLog(@"Object at 3 is %@", [items objectAtIndex:3]);

        for (int i = 0; i < [items count]; i++) {
            NSLog(@"%@", [items objectAtIndex:i]);
        }
        items = nil;           
    }
    return 0;
}
Run Code Online (Sandbox Code Playgroud)

我每次运行时都应该在控制台中获取它:

2012-04-11 …
Run Code Online (Sandbox Code Playgroud)

console xcode objective-c nslog

3
推荐指数
1
解决办法
1339
查看次数

标签 统计

console ×1

nslog ×1

objective-c ×1

xcode ×1