How to print something to the console in Xcode?

后端 未结 6 1046
逝去的感伤
逝去的感伤 2021-02-06 20:45

How do you print something to the console of Xcode, and is it possible to view the Xcode console from the app itself?

Thanks!

6条回答
  •  礼貌的吻别
    2021-02-06 21:09

    In some environments, NSLog() will be unresponsive. But there are other ways to get output...

    NSString* url = @"someurlstring";
    printf("%s", [url UTF8String]);
    

    By using printf with the appropriate parameters, we can display things this way. This is the only way I have found to work on online Objective-C sandbox environments.

提交回复
热议问题