Skip to content

Commit

Permalink
优化版本号匹配UI提示
Browse files Browse the repository at this point in the history
Change-Id: I6af2bbc8cb8fdd50b0705402481b5b43214459d3
(cherry picked from commit 3641af6)
  • Loading branch information
tonychanchen committed Sep 16, 2021
1 parent 0e38d78 commit a0daca8
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -111,10 +111,17 @@ - (void)viewDidLoad {
//云存事件列表
[self requestCloudStoreVideoList];

[[TIoTCoreXP2PBridge sharedInstance] startAppWith:[TIoTCoreAppEnvironment shareEnvironment].cloudSecretId
int errorcode = [[TIoTCoreXP2PBridge sharedInstance] startAppWith:[TIoTCoreAppEnvironment shareEnvironment].cloudSecretId
sec_key:[TIoTCoreAppEnvironment shareEnvironment].cloudSecretKey
pro_id:[TIoTCoreAppEnvironment shareEnvironment].cloudProductId
dev_name:self.deviceName?:@""];
if (errorcode == XP2P_ERR_VERSION) {
UIAlertController *alertC = [UIAlertController alertControllerWithTitle:@"APP SDK 版本与设备端 SDK 版本号不匹配,版本号需前两位保持一致" message:nil preferredStyle:(UIAlertControllerStyleAlert)];
UIAlertAction *alertA = [UIAlertAction actionWithTitle:@"确定" style:(UIAlertActionStyleDefault) handler:^(UIAlertAction * _Nonnull action) {
}];
[alertC addAction:alertA];
[self presentViewController:alertC animated:YES completion:nil];
}

//计算IPC打洞开始时间
self.startIpcP2P = CACurrentMediaTime();
Expand Down
13 changes: 9 additions & 4 deletions Source/SDK/LinkVideo/TIoTCoreXP2PBridge.h
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
//

#import <Foundation/Foundation.h>
#include "AppWrapper.h"

NS_ASSUME_NONNULL_BEGIN

Expand All @@ -21,11 +22,15 @@ NS_ASSUME_NONNULL_BEGIN
+ (NSString *)getSDKVersion;
+ (instancetype)sharedInstance ;

// 调试SDK功能可以使用此接口,OEM请使用下面的start xp2pinfo, 以防止sec_id ,sec_key泄露
- (void)startAppWith:(NSString *)sec_id sec_key:(NSString *)sec_key pro_id:(NSString *)pro_id dev_name:(NSString *)dev_name ;
/*
* 调试SDK功能可以使用此接口,OEM请使用下面的start xp2pinfo, 以防止sec_id ,sec_key泄露
*/
- (XP2PErrCode)startAppWith:(NSString *)sec_id sec_key:(NSString *)sec_key pro_id:(NSString *)pro_id dev_name:(NSString *)dev_name ;

// OEM 版本推荐使用此接口,sec_id, sec_key 传@""即可。 此接口需传从自建服务获取到的 xp2pinfo .
- (void)startAppWith:(NSString *)sec_id sec_key:(NSString *)sec_key pro_id:(NSString *)pro_id dev_name:(NSString *)dev_name xp2pinfo:(NSString *)xp2pinfo;
/*
* OEM 版本推荐使用此接口,sec_id, sec_key 传@""即可。 此接口需传从自建服务获取到的 xp2pinfo
*/
- (XP2PErrCode)startAppWith:(NSString *)sec_id sec_key:(NSString *)sec_key pro_id:(NSString *)pro_id dev_name:(NSString *)dev_name xp2pinfo:(NSString *)xp2pinfo;


- (NSString *)getUrlForHttpFlv:(NSString *)dev_name;
Expand Down
9 changes: 4 additions & 5 deletions Source/SDK/LinkVideo/TIoTCoreXP2PBridge.mm
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@

#import "TIoTCoreXP2PBridge.h"
#include <string.h>
#include "AppWrapper.h"
#import "AWSystemAVCapture.h"
#import <CocoaLumberjack/CocoaLumberjack.h>

Expand Down Expand Up @@ -117,19 +116,19 @@ + (void)redirectNSLog {
}


- (void)startAppWith:(NSString *)sec_id sec_key:(NSString *)sec_key pro_id:(NSString *)pro_id dev_name:(NSString *)dev_name {
- (XP2PErrCode)startAppWith:(NSString *)sec_id sec_key:(NSString *)sec_key pro_id:(NSString *)pro_id dev_name:(NSString *)dev_name {
// setStunServerToXp2p("11.11.11.11", 111);
[self startAppWith:sec_id sec_key:sec_key pro_id:pro_id dev_name:dev_name xp2pinfo:@""];
return [self startAppWith:sec_id sec_key:sec_key pro_id:pro_id dev_name:dev_name xp2pinfo:@""];
}

- (void)startAppWith:(NSString *)sec_id sec_key:(NSString *)sec_key pro_id:(NSString *)pro_id dev_name:(NSString *)dev_name xp2pinfo:(NSString *)xp2pinfo {
- (XP2PErrCode)startAppWith:(NSString *)sec_id sec_key:(NSString *)sec_key pro_id:(NSString *)pro_id dev_name:(NSString *)dev_name xp2pinfo:(NSString *)xp2pinfo {
//注册回调
setUserCallbackToXp2p(XP2PDataMsgHandle, XP2PMsgHandle);

//1.配置IOT_P2P SDK
self.dev_name = dev_name;
setQcloudApiCred([sec_id UTF8String], [sec_key UTF8String]); //正式版app发布时候需要去掉,避免泄露secretid和secretkey,此处仅为演示
startServiceWithXp2pInfo(dev_name.UTF8String, [pro_id UTF8String], [dev_name UTF8String], [xp2pinfo UTF8String]);
return (XP2PErrCode)startServiceWithXp2pInfo(dev_name.UTF8String, [pro_id UTF8String], [dev_name UTF8String], [xp2pinfo UTF8String]);
}

- (NSString *)getUrlForHttpFlv:(NSString *)dev_name {
Expand Down

0 comments on commit a0daca8

Please sign in to comment.