2017-08-12 14 views
0

私はiOS TweakのPython?

EDIT(のpython 3.5.3のiOSライブラリ)https://github.com/pybee/Python-Apple-supportを使用してみました:私はHackScript_PRIVATE_FRAMEWORKS = Python.frameworkを追加しようとしたが、それは私が含ましようとすると、Pythonの/はPython.hが存在doesntの言います。

Tweak.xm:

#include "Python\Python.framework\Versions\3.5\Resources\include\python3.5\Python.h" 
%hook SpringBoard 

- (void)applicationDidFinishLaunching:(id)application { 
    %orig; 

    PyObject *py_main, *py_dict; 
    py_main = PyImport_AddModule("__main__"); 
    py_dict = PyModule_GetDict(py_main); 

    PyObject *PyRes = PyRun_String("print(\"This is a test message from HackScript\")", Py_single_input, py_dict, py_dict); 

    PyObject *PyResRep = PyObject_Str(PyRes); 

    char *PyResCStr = PyBytes_AS_STRING(PyResRep); 
    NSString *PyResStr = @(PyResCStr); 

    UIAlertView *alert1 = [[objc_getClass("UIAlertView") alloc] initWithTitle:@"Welcome" 
     message:PyResStr 
     delegate:self 
     cancelButtonTitle:@"k" 
     otherButtonTitles:nil]; 

     [alert1 show]; 

     [alert1 release]; 
} 

%end 

のMakefile:

export ARCHS = armv7 armv7s arm64 
export TARGET = iphone:clang:8.1:8.1 
export SDKVERSION=8.1 

include $(THEOS)/makefiles/common.mk 

TWEAK_NAME = HackScript 
HackScript_FILES = Tweak.xm 

include $(THEOS_MAKE_PATH)/tweak.mk 

after-install:: 
    install.exec "killall -9 SpringBoard" 

が、私ははPython.hが含まれており、Pythonのオブジェクトにアクセスしようとすると、compillingとき、それは私にこのエラーを与える:

Undefined symbols for architecture armv7: 
    "_PyImport_AddModule", referenced from: 
     __ZL67_logos_method$_ungrouped$SpringBoard$applicationDidFinishLaunching$P11SpringBoardP13objc_selectorP11objc_object in Tweak.xm.2544b2e5.o 
    "_PyModule_GetDict", referenced from: 
     __ZL67_logos_method$_ungrouped$SpringBoard$applicationDidFinishLaunching$P11SpringBoardP13objc_selectorP11objc_object in Tweak.xm.2544b2e5.o 
    "_PyObject_Str", referenced from: 
     __ZL67_logos_method$_ungrouped$SpringBoard$applicationDidFinishLaunching$P11SpringBoardP13objc_selectorP11objc_object in Tweak.xm.2544b2e5.o 
    "_PyRun_StringFlags", referenced from: 
     __ZL67_logos_method$_ungrouped$SpringBoard$applicationDidFinishLaunching$P11SpringBoardP13objc_selectorP11objc_object in Tweak.xm.2544b2e5.o 
ld: symbol(s) not found for architecture armv7 
arm64-apple-darwin14-clang-3.9: error: linker command failed with exit code 1 (use -v to see invocation) 
make[3]: *** [/opt/theos/makefiles/instance/library.mk:33: /home/jujha/projects/hackscript/.theos/obj/debug/armv7/HackScript.dylib] Error 1 
make[2]: *** [/opt/theos/makefiles/instance/library.mk:32: /home/jujha/projects/hackscript/.theos/obj/debug/armv7/HackScript.dylib] Error 2 
make[1]: *** [/opt/theos/makefiles/instance/library.mk:24: internal-library-all_] Error 2 
make: *** [/opt/theos/makefiles/master/rules.mk:90: HackScript.all.tweak.variables] Error 2 

これは私の仕事に埋め込むことができるスクリプト言語を推薦することができますか?

答えて

0

を使用すると、コピー・フェーズでは、あなたのバイナリにPython.frameworkをコピーしたことがありますか?

GitHub上の問題のセクションを参照してください。

+0

私はそれをどのように正確に行うのですか? (申し訳ありませんのiOS開発とObjective-Cのに新しいイム)Project Navigatorで –

+0

、プロジェクト(左ペインの一番上の青いアイコン)をクリックし、+クリックしてPython.frameworkを選択し、フェーズ、オープンコピーバンドルリソースのビルド]をクリックします。 – Xvolks

+0

私はcygwinとテキストエディタを使ってxcodeを使っていません –

関連する問題