Python Hello World in PyObjC on iPhone?

社会主义新天地 提交于 2019-12-08 08:55:43

问题


I installed the iphone-python package from Cydia, but the HelloPython app closes immediately when I run it from Springboard.

This may be a red herring, but I found the .py file in Terminal and tried to run it with python and got a python error:

$ python /private/var/stash/Applications.pwn/HelloPython.app/HelloPython.py
Traceback (most recent call last):
  File "/private/var/stash/Applications.pwn/HelloPython.app/HelloPython.py", line 9, in <module>
    import objc
  File "/usr/lib/python2.5/objc/__init__.py", line 17, in <module>
    _update()
  File "/usr/lib/python2.5/objc/__init__.py", line 14, in _update
    import _objc
ImportError: dlopen(/usr/lib/python2.5/lib-dynload/_objc.dylib, 2): Symbol not found: _OBJC_CLASS_$_Object
  Referenced from: /usr/lib/python2.5/lib-dynload/_objc.dylib
  Expected in: /usr/lib/libobjc.A.dylib

I'm running 4.3.3.

How can I get this app working, so I'll have a working example of PyObjC?


回答1:


Well due to the changes in the way executables on the new ios run, the dynamic library has become corrupt. The mach-o will no longer run due to the upgraded objective-c so a workaround would be to compile pyobjc from source and run normaly. The only ptoblem with that is that the iphone's version of pyobjc is built for uikit so you would need to find saurik's (Jay Freeman) source code and compile it. I might do that for myself so ill post back with a deb file if i do.



来源:https://stackoverflow.com/questions/5999366/python-hello-world-in-pyobjc-on-iphone

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!