iOS 10 doesn't print NSLogs

后端 未结 9 1483
情书的邮戳
情书的邮戳 2020-12-04 09:43

Nothing prints from NSLog on Xcode 8.0 beta (8S128d). printf is unchanged

Here\'s my code:

NSLog(@\"hello from NSLog\");
pr         


        
9条回答
  •  情书的邮戳
    2020-12-04 10:12

    It could be that you added the property "OS_ACTIVITY_MODE": "disable" in the Scheme environment variables (to hide OS output from the simulator) and forgot about it, and now are running on a real device.

    In Xcode 8:

    Product -> Scheme -> Edit Scheme -> Run -> Arguments -> Environment Variables
    

    Only add OS_ACTIVITY_MODE and check it(Don't add a value)

    Summary: This is a bug of Xcode 8 + iOS10, we can solve it in this way:

    • When using the simulator, add the Name "OS_ACTIVITY_MODE" and the Value "disable" and check it.

    • When on a real device, only add "OS_ACTIVITY_MODE" and check it(Don't add the Value). You will see the NSLog in the Xcode8 Console.

提交回复
热议问题