IOS工程:提供给Unity调用的SDK包工程

leon 1faa2f0251 优化调试数据 2 anni fa
IMAGES 1faa2f0251 优化调试数据 2 anni fa
IOSToUnityBundle 51db4f2727 new 3 anni fa
IOSToUnitySDK 51db4f2727 new 3 anni fa
IOSToUnitySDK.xcodeproj 1faa2f0251 优化调试数据 2 anni fa
IOSToUnitySDK.xcworkspace 1faa2f0251 优化调试数据 2 anni fa
SDK 1faa2f0251 优化调试数据 2 anni fa
.DS_Store 1faa2f0251 优化调试数据 2 anni fa
README.md bbaa0892ba 更新 'README.md' 3 anni fa

README.md

< SDK工程导出sdk包流程说明

1.打开xcode,在Edit Scheme位置选择你要导出的Framework包,根据你要导出的包类型(真机或模拟器),command+b编译导出Framework包
2.打开xcode,在Edit Scheme位置选择你要导出的Bundle包,根据你要导出的包类型(真机或模拟器),command+b编译导出Bundle包

1638324216111.jpg

导出的包在工程目录Products下,右键show in finder可查看

< 导出的sdk包配置进xcode unity游戏工程说明

导入SDK:将.framework和.bundle放在工程根目录下

(配置包名:com.Oujia.***,添加App Group、Background Model)

配置允许访问https和蓝牙功能:(在工程info.plist文件中添加以下xmal代码)
<key>NSAppTransportSecurity</key>
<dict>
<key>NSAllowsArbitraryLoads</key>
<true/>
</dict>
<key>NSBluetoothAlwaysUsageDescription</key>
<string>App 需要您的同意,才能访问蓝牙连接智能鞋</string>
<key>NSBluetoothPeripheralUsageDescription</key>
<string>App 需要您的同意,才能访问蓝牙连接智能鞋</string>
Unity IOS工程配置URL Schemes和identifler(在工程TAGETS的URLType中添加)

//跑酷: identifler : RunGame

    URL Schemes: com.RunGame.oujia

//跳舞: identifler : DanceGame

    URL Schemes:  com.DanceGame.oujia
初始化sdk

//1.在程序入口UnityAppController.mm文件中导入SDK头文件

#import <IOSToUnitySDK/IOSPlatformSDK.h>

//2.在程序入口中添加启动SDK 代码如下

 - (BOOL)application:(UIApplication*)application didFinishLaunchingWithOptions:(NSDictionary*)launchOptions
{
     if(launchOptions[UIApplicationLaunchOptionsURLKey]){
      NSURL *url = [launchOptions objectForKey:UIApplicationLaunchOptionsURLKey];
         NSLog(@"打开方式 通过URL打开的  ===== >> %@",url);
         IOSPlatformSDK * sdk = [IOSPlatformSDK sharedInstance];
         [sdk startWithUrl:url];
     }

}

//3.从趣动App跳转的回调方法中添加如下代码

- (BOOL)application:(UIApplication*)app openURL:(NSURL*)url options:(NSDictionary<NSString*, id>*)options
{
    IOSPlatformSDK * sdk = [IOSPlatformSDK sharedInstance];
    [sdk startWithUrl:url];
}
跑酷游戏工程另需配置
1.chmod +x ~/MapFileParser.sh 文件授权
2.添加编译文件PluginInterface.mm
3.修改Enable Bitcode为NO
4.TARGETS下的UnityFramework配置bundle平台为ios+mac