luapower / objc

Objective-C & Cocoa Bridge
http://luapower.com/objc
25 stars 7 forks source link

'struct objc_object' is not callable (macOS Sierra 10.12.3) #3

Closed fdagostino closed 6 years ago

fdagostino commented 7 years ago

Enviroment

Description

When running a simple script I get the following output in ZeroBrane Studio or in Terminal Console:

Program starting as '"/Applications/ZeroBraneStudio.app/Contents/ZeroBraneStudio/bin/lua.app/Contents/MacOS/lua" -e "io.stdout:setvbuf('no')" "/Users/Francisco/dev/test/test.lua"'.
Program 'lua' started in '/Users/Francisco/dev/test' (pid: 22951).
/Applications/ZeroBraneStudio.app/Contents/ZeroBraneStudio/bin/lua.app/Contents/MacOS/lua: /Users/Francisco/dev/test/test.lua:5: 'struct objc_object' is not callable
stack traceback:
    [C]: in function 'operatingSystemVersionString'
    /Users/Francisco/dev/test/test.lua:5: in main chunk
    [C]: at 0x00001c80
Program completed in 0.11 seconds (pid: 22951).

Repro

local objc = require('objc.objc')
objc.load('Foundation')
print(objc.tolua(objc.NSProcessInfo:processInfo():operatingSystemVersionString()))
capr commented 6 years ago

Sorry for late reply hehe :) I totally missed your issue for like, 8 months... It seems like they "modernized" Cocoa in 10.10 changing a ton of getters to properties. You can read more about it here: https://developer.apple.com/library/content/releasenotes/MacOSX/WhatsNewInOSX/Articles/MacOSX10_10.html (section "Frameworks and Framework Technologies")

So on 10.10+ you should do:

print(objc.tolua(objc.NSProcessInfo:processInfo().operatingSystemVersionString))

Did you find other issues with objc or gave up on this example?

capr commented 6 years ago

(accidentally hit close)

capr commented 6 years ago

Fixed (see #4)