Appearance
手动集成
某些情况下,可能插件无法处理所有流程,因此提供手动接入的方式
iOS for CococCreator3.x
仅导入插件的Seeg.d.ts(
文件位置:seeg-sdk/code-v3/sdk/Seeg.d.ts,防止代码爆红),然后按正常流程构建项目导入脚本SDK(
文件位置:seeg-sdk/static/adapters/ios/seeg.js),如果勾选了跳过Xcode更新,则可以将脚本直接放到build/iOS/data目录下,否则需要在XCode的Build Phases->Copy Bundle Resources中引用在项目中(
main.js)引用该脚本
// main.js
require('./seeg.js');将物料的
GoogleService-Info.plist(如果有)拖到项目中,保证在Build Phases->Copy Bundle Resources中引用打开物料的
info.json(如果有),将其中的内容合并到info.plist,注意,json格式转plist格式的不同,可能需要额外处理,建议通过插件转换将物料的
Podfile合并到自己工程的Podfile,可以搜索SeegSDK相关字样将物料的
seeg_sdk_param.json拖到项目中,保证在Build Phases->Copy Bundle Resources中引用注册脚本与原生的交互
// AppDelegate.mm
#include "application/ApplicationManager.h"
#include "bindings/jswrapper/SeApi.h"
#import <SeegBridge/SeegBridgeSDK.h>
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
// ...
[SeegBridgeSDK registerJSExecutor:^(NSString * _Nonnull jsCode) {
std::string cppCode = [jsCode UTF8String];
CC_CURRENT_ENGINE()->getScheduler()->performFunctionInCocosThread([=](){
se::ScriptEngine::getInstance()->evalString(cppCode.c_str());
});
}];
// ...
}