我尝试使用https://github.com/pybee/Python-Apple-support(python 3.5.3 ios库)
编辑:我尝试添加export default class extends Component {
constructor(props) {
super(props);
this.state = {
markers: []
value: ''
}
handleChange(event) {
callback = () => {
console.log(this.state.markers);
}
markers.forEach((place,index) => {
.....
services.getDetails(request, (place, status) => {
if(place != null){
.....
}else{
}
itemsProcessed++;
if(itemsProcessed === markers.length) {
this.callback();
}
});
});
}
}
,但是当我尝试包含时,它说Python / Python.h不存在。
Tweak.xm:
HackScript_PRIVATE_FRAMEWORKS = Python.framework
生成文件:
#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
但是当我包含Python.h并尝试访问python对象时,它会在编译时出现此错误:
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"
如果这不起作用,任何人都可以推荐一种脚本语言,我可以将其嵌入到我的theos调整中吗?