[Pyobjc-dev] Need some help creating/dealing with struct types
Brought to you by:
ronaldoussoren
From: Robert K. <rob...@gm...> - 2015-08-19 07:22:01
|
All, My goal is to call [SFAuthorization authorizationWithFlags:rights:environment:] <https://developer.apple.com/library/prerelease/mac/documentation/Security/Reference/SecurityFoundationFramework/Classes/SFAuthorization_Class/index.html#//apple_ref/occ/clm/SFAuthorization/authorizationWithFlags:rights:environment:> from PyObjC. My main issue is with the `rights` argument, a pointer to AuthorizationRights <https://developer.apple.com/library/prerelease/mac/documentation/Security/Reference/authorization_ref/index.html#//apple_ref/swift/tdef/c:@T@AuthorizationRights>. I initially found this issue: Add ctypes support <https://bitbucket.org/ronaldoussoren/pyobjc/issues/23/add-ctypes-support>, which uses ctypes to create AuthorizationRights. However, even though the issue was solved, I have no idea how to get it working (PyObjC 3.0.4 on OSX 10.10.4). Specifically, I'm using this: auth = SFAuthorization.authorizationWithFlags_rights_environment_( 19, ctypes.pointer(authorization_rights), None) Which results in an error similar to the one mentioned in the issue: ValueError: depythonifying 'pointer', got 'LP_AuthorizationRights' I also looked at objc.createStructType() <https://pythonhosted.org/pyobjc/metadata/manual.html#objc.createStructType> to use instead of ctypes, but got stuck on the `typestr` argument (I can't find any documentation on it; I assumed it might be similar to Objective-C method signatures, but those aren't very well documented either). Any help would be greatly appreciated! – robert |