2017-08-12 5 views
0

i essayé d'utiliser https://github.com/pybee/Python-Apple-support (le python 3.5.3 bibliothèque ios)Python dans iOS Tweak?

EDIT: J'ai essayé d'ajouter HackScript_PRIVATE_FRAMEWORKS = Python.framework mais il dit Python/Python.h ne marche pas exister lorsque je tente d'inclure.

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" 

mais quand je Python.h et inclus essaie d'objets python d'accès, il me donne cette erreur lorsque 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 

si cela ne fonctionnera pas quelqu'un peut-il recommander un langage de script je peux intégrer dans mon tweak theos?

Répondre

0

Avez-vous copié le nom Python.framework dans votre fichier binaire dans la phase de copie?

Voir la section des problèmes sur GitHub.

+0

Comment faire exactement cela? (désolé im nouveau pour le développement d'ios et l'objectif-c) –

+0

Dans Project Navigator, cliquez sur votre projet (l'icône la plus bleue dans le volet de gauche), cliquez sur Build Phase, Ouvrir les ressources Bundle, cliquez sur + et sélectionnez votre Python.framework. – Xvolks

+0

euhh je ne suis pas en utilisant xcode im en utilisant cygwin et un éditeur de texte –