Python脚本移除Unity中的UIWebview
前言:众所周知,苹果已经限制了带UIWebview的二进制文件上传,然而旧版的Unity引擎中仍然在使用相关API,并且在libiPhone-lib.a的静态库中,接下来教你如何用移除它,并整合成Python脚本。
1、首先准备以下代码,命名为URLUtility.mm,用于重新编译并替换原来静态库的代码`
#include <iostream>
#import <UIKit/UIKit.h>
using namespace std;
namespace core {
template <class type>
class StringStorageDefault {
};
template <class type,class type2>
class basic_string {
public:
char * str;
basic_string( char* arg){
str = arg;
}
};
}
void OpenURLInGame(core::basic_string< char,core::StringStorageDefault<char> > const&arg){
}
void OpenURL(core::basic_string<char,core::StringStorageDefault<char> >const &arg){
const void *arg2 = arg.str;
UIApplication *app = [UIApplication sharedApplication];
NSString *urlStr = [NSString stringWithUTF8String:(char *)arg2];
NSURL *url = [NSURL URLWithString:urlStr];
[app openURL:url];
}
void OpenURL(std::string const&arg){
UIApplication