Few days ago i experimented realm.io, a more powerful (and intuitive) alternative version to CoreData(ObjC) and SQLite.
Obviously I searched for an implementation for my favourite language, Python. I didn't find it :-( .
Can @ole implement the framework/module offering an alternative to sqlite?
Also, pretty crazy but is possible to install custom objc frameworks and make them work using objc_util?
Thanks in advance,
Please don't take my words seriously, I don't have experience and I haven't tested. Maybe this is a solution: you put your framework in Pythonista and then load it.
from objc_util import * ObjCClass('NSBundle').bundleWithPath_('MyFramework.framework').load()
Ok, now i'll test this, if it works you are THE genius
Ok, your method seems to load the framework but
- i dont know what to do next
- Or there is libc++.dylib to link (dunno if Pythonista has it linked)
Once you load the framework you can access the classes you need with
You can even call private APIs, but this is useless since iOS 7 because apps must have certain entitlements to be able to trigger certain methods. Here is an example to open Siri (that fails silently).
from objc_util import * # Load the framework ObjCClass('NSBundle').bundleWithPath_('/System/Library/PrivateFrameworks/AccessibilityUtilities.framework').load() # "Import" one of its class AXSpringBoardServer = ObjCClass('AXSpringBoardServer') # Call a class' method AXSpringBoardServer.alloc().openSiri()
About the dynamic library, I can't help you.
Can this be applied to OpenCV if I download the objective-c bindings?
codesign -s "iPhone Developer" Realm.framework
(the version in ios/dynamic – this obviously requires that you have a valid iOS code signing identity in your keychain)
...then I copied the signed framework to Pythonista, and tried the following:
from objc_util import * NSBundle = ObjCClass('NSBundle') bundle = NSBundle.bundleWithPath_('Realm.framework') loaded = bundle.load() print 'Framework loaded: %s' % loaded RLMObject = ObjCClass('RLMObject') print RLMObject
I haven't done anything else with it, and to be honest, I have my doubts if this particular framework will be of much use in Pythonista (the lack of block support in
objc_utilmight be limiting), but it's still pretty amazing that the technique seems to work in general. Thanks @jan4843!
I've also tried an unsigned version of the framework. In that case, the
False(which I expected), but I'm not sure if there's a requirement that a loaded framework is signed by the same key as the app that loads it (which is obviously not a problem for me, but it wouldn't work for others if that's the case).
Thanks omz for trying it out! As expected I was missing something (the signature), but unfortunately I don't have a code signing identity to try with a different key.
Thank you for your work.
@omz I posted this reference before on the situation with dynamic link libraries on IOS:
It's long article and a rant about how stupid it is that IOS developers can't have dynamic link libraries and how this is holding the platform back. The article proves that you can code sign your own libraries and use them from your app as a developer. Its is also implied that you can load and access any framework that is available.
The question I have is - what's to stop you from selling your customers custom versions of Pythonista that are signed with their own developer keys? Why can't I pony up the $100 to Apple and then send you my key and let you send me back a signed "version" of Pythonista. Then you could also break Pythonista into dll's that would also need to be custom signed with each devs particular key. Granted - you would have to go to a more plug-in architecture but you can see where I headed with this - right? I don't think Apple could get too bent out of shape if you did this since other development environments such as PhoneGap already support something close to this. I know that PhoneGap has a server based build environment that allows you to enter your keys and they do the whole build for you - no XCode dev setup required.
@omz did you use the same signing identity you used to sign Pythonista to sign the Realm framework?
@lukaskollmer Yeah. That only worked in the development version of Pythonista though. App Store apps are signed by Apple...
@omz does Apple sign one app with the same private key?
Can we sign one app by Apple, then get the signed dynamic library in unzipped ipa file ?