【问题标题】:Xcode console does not show NSLog output, only (lldb) [duplicate]Xcode控制台不显示NSLog输出,仅(lldb)[重复]
【发布时间】:2015-11-14 22:28:42
【问题描述】:

我正在尝试在 Xcode 中运行以下命令:

#import <Foundation/Foundation.h>

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

//        NSLog(@"Hello, my name is Travis");
//        NSString *firstName = @"Variable";
//        NSLog(@"Hello, my name is %@", firstName);
//        NSString *lastName = @"Last Name";
//        NSLog((@"First name: %@, Last name: %@", firstName, lastName));
//        NSNumber *age = @26;
//        NSLog(@"%@ age is %@", firstName, age);
//        NSArray *items = @[@"item1", @"item2", @"item3"];
//        NSLog(@"%@",items[1]);
//        NSLog(@"%@", [items description]);
//        NSString *result = [items description];
//        NSLog(result);
        NSString *city = @"San Francisco";
        NSUInteger cityLength = [city length];
        NSLog(@"%lu", cityLength);
//        NSMutableArray *mystr = [NSMutableArray arrayWithObjects:@"hello",@"world", nil];
//        NSLog(@"%@", mystr[0]);
//        NSString *me = @"FROM ME!";
//        [mystr addObject: me];
//        NSLog(@"%@", mystr[2]);
//        NSDictionary *appRatings = @{@"item1": @4, @"item2": @3};
//        NSLog(@"%@", [appRatings allKeys]);
//        NSLog(@"%@", [appRatings objectForKey:@"item1"]);
//        NSLog(@"%@", [appRatings allValues]);
//        NSLog(@"%@", [appRatings valueForKey:@4]);

    }

}  

我只是想运行未注释的代码。看起来很简单,应该只计算我的字符串变量中的字符数。当我运行它时,构建成功,但控制台中没有任何内容。唯一出现的是:(lldb)

【问题讨论】:

    标签: objective-c xcode nslog


    【解决方案1】:

    lldb 表示代码在某个断点处暂停,正在等待 lldb 命令。禁用断点或找到并删除它们,然后重试。

    【讨论】:

    • 我想说的是,我认为那是只有在 Swift 中才能完成的事情。很好的抓住乔希。另外,感谢@ILikeTau,因为它帮助我解决了我的问题。
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2014-10-22
    • 2011-09-09
    • 1970-01-01
    • 2014-02-07
    • 2014-06-30
    • 2015-02-22
    • 1970-01-01
    相关资源
    最近更新 更多