# IOS-JS **Repository Path**: brtbeacon/ios-h5-interaction ## Basic Information - **Project Name**: IOS-JS - **Description**: No description available - **Primary Language**: Unknown - **License**: Not specified - **Default Branch**: master - **Homepage**: None - **GVP Project**: No ## Statistics - **Stars**: 0 - **Forks**: 0 - **Created**: 2021-03-25 - **Last Updated**: 2021-04-02 ## Categories & Tags **Categories**: Uncategorized **Tags**: None ## README # IOS-YS—ZS-JS #### 介绍 通过APP展示定位H5地图,本demo主要包含app与h5交互:展示H5地图、js调用APP蓝牙和GPS状态、调用IOS系统分享、APP传人js扫描数据等。 #### 安装教程 1. 引入 ``` 1. 引入本demo内:WebVC(webview设置相关代码必要),ZSWebSDK(zs调用必要),JSHandler(ysApi必要) 2. 新建[[WebVC alloc] initWithURLString:]视图类 3. url传人您的地图地址。 4. 配置plist相关权限: ``` #### 必需配置 ``` NSLocationWhenInUseUsageDescription 允许使用期间定位进行室内导航 NSBluetoothPeripheralUsageDescription 打开蓝牙来进行定位 NSMicrophoneUsageDescription 用于语音搜索服务 ``` 以下按项目所需可选(请如需填写,否则可能意外闪退) ``` NSLocationAlwaysUsageDescription 允许软件在后台使用定位 NSLocationAlwaysAndWhenInUseUsageDescription 允许软件在后台使用定位 NSCameraUsageDescription 进行实景导航 ``` 2. 初始化 ``` //初始化定位地图服务所需JS回调 [ZSWebSDK setupWebView:_webView]; //初始化自定义yaApi接口,设置js登录监听 [JSHandler handlerJSLogin:_webView onLoginClicked:^(id _Nonnull args) { [self.navigationController pushViewController:LoginVC.new animated:YES]; }]; [JSHandler handlerJSDetail:_webView onDetailClicked:^(id _Nonnull args) { [self.navigationController pushViewController:DetailVC.new animated:YES]; }]; ``` 3. 设置用户数据 ``` [JSHandler refreshJSUserData:(NSString *)self.userData]; ``` #### 注意:如果h5地址不是https,请务必配置plist(若固定url也可白名单配置): ``` NSAppTransportSecurity NSAllowsArbitraryLoads ``` ### changeLog 添加ZSWebSDK 添加detail接口