NSLog problem with PB6
Re: NSLog problem with PB6
I can test it though which log would I be looking at?
Re: NSLog problem with PB6
To see system logs, open Console app, press "Start" on top, input "PureBasic" in the search field, then pick any code example in this topic that works for other people (like the last one from mk-soft), then run it.
Re: NSLog problem with PB6
If I'm looking at the expected output, I see the following (M2 Macbook Air):
Output: (null)
I used the following code:
Output: (null)
I used the following code:
Code: Select all
Macro CocoaString(NSString)
PeekS(CocoaMessage(0, NSString, "UTF8String"), -1, #PB_UTF8)
EndMacro
Macro CocoaCString(NSString)
PeekS(CocoaMessage(0, NSString, "cStringUsingEncoding:", #NSUTF16LittleEndianStringEncoding))
EndMacro
Macro CocoaAllocString(String)
CocoaMessage(0, 0, "NSString stringWithBytes:", @String, "length:", StringByteLength(String), "encoding:", #NSUTF16LittleEndianStringEncoding)
EndMacro
ImportC ""
NSLog(format, message)
EndImport
Define format = CocoaAllocString("Output: %S")
Define message.s = "Test: " + FormatDate("%HH:%II:%SS", Date())
NSLog(format, @message)
Re: NSLog problem with PB6
Thanks! Then this should be a bug in arm compiler, I'll create a bug report later.
Re: NSLog problem with PB6
No problem!
Re: NSLog problem with PB6
Try the delay ...
If the programme ends too quickly, the log does not arrive.
For format string: https://developer.apple.com/library/arc ... fiers.html
If the programme ends too quickly, the log does not arrive.
For format string: https://developer.apple.com/library/arc ... fiers.html
Code: Select all
Macro CocoaString(NSString)
PeekS(CocoaMessage(0, NSString, "UTF8String"), -1, #PB_UTF8)
EndMacro
Macro CocoaCString(NSString)
PeekS(CocoaMessage(0, NSString, "cStringUsingEncoding:", #NSUTF16LittleEndianStringEncoding))
EndMacro
Macro CocoaAllocString(String)
CocoaMessage(0, 0, "NSString stringWithBytes:", @String, "length:", StringByteLength(String), "encoding:", #NSUTF16LittleEndianStringEncoding)
EndMacro
ImportC ""
NSLog(format, message)
EndImport
Define format = CocoaAllocString("Output: %S")
Define message.s = "Time: " + FormatDate("%HH:%II:%SS", Date())
NSLog(format, @message)
Delay(1000)
My Projects ThreadToGUI / OOP-BaseClass / EventDesigner V3
PB v3.30 / v5.75 - OS Mac Mini OSX 10.xx - VM Window Pro / Linux Ubuntu
Downloads on my Webspace / OneDrive
PB v3.30 / v5.75 - OS Mac Mini OSX 10.xx - VM Window Pro / Linux Ubuntu
Downloads on my Webspace / OneDrive
Re: NSLog problem with PB6
No luck with that either (with ARM application).
Re: NSLog problem with PB6
Same issue: Output: (null) even with the delay on an ARM CPU
Re: NSLog problem with PB6
Not sure if it matters but by default I set the PB6 compiler to optimize code.
Re: NSLog problem with PB6
Nope, I have "Optimize generated code" unchecked and it doesn't work anyway.
I created a bug here.
I created a bug here.