NSLog in console or other way to log

(Andreas Kiel) #1

I’ve finally an app release (replacement of ASS app) which runs fine and fast on my machine.
I sent out to a few users to test and it doesn’t work. No crash.

Is there a way they can see something in console or another way to track what happens?

(Shane Stanley) #2

Yes, you can use NSLog, and probably even AS’s log. The catch is that they need to have Console.app running while it happens.

(Andreas Kiel) #3

Thanks Shane for your continuos help!

(Shane Stanley) #4

Be careful with NSLog. You might be tempted to use something like:

set x to 3
current application's NSLog("x is %d", 3)

But that may well crash your app. The problem is although x is an AppleScript integer, in the absence of guidance from a method signature it will be bridged to an NSNumber. That means the placeholder needs to be %@, not %d.

As a rule of thumb, stick to %@, and don’t try to log objects of classes that aren’t bridged to Objective-C classes.

(Andreas Kiel) #5

Thanks for the hint!