App Linker
App Linker 는 외부 앱을 실행 시키기 위한 기능을 가지고 있으며, Optional 한 기능이므로 사용자가 별도로 개발하여 사용해도 무방하다.
확장 프레임워크 파일을 추가하여 사용할 수 있으며 추가 방법은 iOS 개발 가이드 의 내용을 참조한다.
start
다른 앱을 실행 할 수 있는 기능이며 호출 방법은 다음과 같다.
Example
///////////////
// 3.10.18 이상
///////////////
let linker = DAPAppLinker()
let param = DAPAppLinkerStartParam()
param.scheme = "com.hanwha.Verify"
param.contents = "values"
linker.execute(with: param, completion: { (dict) in
}) { (resultError) in
}
///////////////
// 3.10.18 이하
///////////////
let linker = DAPAppLinker()
let iosDict = ["scheme" : "com.hanwha.Verify", "contents" : "values"]
let dictInfo = ["ios" : iosDict]
let params = [dictInfo] as [Any]
linker.execute(withActionName: "start", params: params, completion: { (dict) in
guard let resultDict = dict else {
return
}
}) { (resultError) in
guard let error = resultError else {
return
}
}
// 3.10.18 이상
///////////////
let linker = DAPAppLinker()
let param = DAPAppLinkerStartParam()
param.scheme = "com.hanwha.Verify"
param.contents = "values"
linker.execute(with: param, completion: { (dict) in
}) { (resultError) in
}
///////////////
// 3.10.18 이하
///////////////
let linker = DAPAppLinker()
let iosDict = ["scheme" : "com.hanwha.Verify", "contents" : "values"]
let dictInfo = ["ios" : iosDict]
let params = [dictInfo] as [Any]
linker.execute(withActionName: "start", params: params, completion: { (dict) in
guard let resultDict = dict else {
return
}
}) { (resultError) in
guard let error = resultError else {
return
}
}
// 3.10.18 이상
DAPDeviceAPI *deviceAPI = [DAPAppLinker new];
DAPAppLinkerStartParam *infoParam = [DAPAppLinkerStartParam new];
infoParam.scheme = @"com.hanwha.Verify";
infoParam.contents = @"values";
[deviceAPI executeWithParam:infoParam completion:^(NSDictionary *resultDict) {
NSString *deviceResult = [resultDict objectForKey:kDeviceResult];
NSLog(@"deviceResult : %@", deviceResult);
} failure:^(NSError *error) {
NSLog(@"error : %@", [error userInfo]);
}];
// 3.10.18 이하
DAPDeviceAPI *deviceAPI = [DAPAppLinker new];
NSDictionary *iosDict = [NSDictionary dictionaryWithObjectsAndKeys:@"com.hanwha.Verify", @"scheme", @"values", @"contents", nil];
NSDictionary *dictInfo = [NSDictionary dictionaryWithObjectsAndKeys:iosDict, @"ios", nil];
NSArray *params = [NSArray arrayWithObjects:dictInfo, nil];
[deviceAPI executeWithActionName:@"start" params:params completion:^(NSDictionary *resultDict) {
} failure:^(NSError *error) {
}];
DAPDeviceAPI *deviceAPI = [DAPAppLinker new];
DAPAppLinkerStartParam *infoParam = [DAPAppLinkerStartParam new];
infoParam.scheme = @"com.hanwha.Verify";
infoParam.contents = @"values";
[deviceAPI executeWithParam:infoParam completion:^(NSDictionary *resultDict) {
NSString *deviceResult = [resultDict objectForKey:kDeviceResult];
NSLog(@"deviceResult : %@", deviceResult);
} failure:^(NSError *error) {
NSLog(@"error : %@", [error userInfo]);
}];
// 3.10.18 이하
DAPDeviceAPI *deviceAPI = [DAPAppLinker new];
NSDictionary *iosDict = [NSDictionary dictionaryWithObjectsAndKeys:@"com.hanwha.Verify", @"scheme", @"values", @"contents", nil];
NSDictionary *dictInfo = [NSDictionary dictionaryWithObjectsAndKeys:iosDict, @"ios", nil];
NSArray *params = [NSArray arrayWithObjects:dictInfo, nil];
[deviceAPI executeWithActionName:@"start" params:params completion:^(NSDictionary *resultDict) {
} failure:^(NSError *error) {
}];
canStart
다른 앱을 실행 할 수 있는지 여부를 확인 할 수 있는 기능이며 호출 방법은 다음과 같다.
Example
///////////////
// 3.10.18 이상
///////////////
let linker = DAPAppLinker()
let param = DAPAppLinkerCanStartParam()
param.scheme = "com.hanwha.Verify"
param.contents = "values"
linker.execute(with: param, completion: { (dict) in
}) { (resultError) in
}
///////////////
// 3.10.18 이하
///////////////
let linker = DAPAppLinker()
let iosDict = ["scheme" : "com.hanwha.Verify", "contents" : "values"]
let dictInfo = ["ios" : iosDict]
let params = [dictInfo] as [Any]
linker.execute(withActionName: "canstart", params: params, completion: { (dict) in
guard let resultDict = dict else {
return
}
}) { (resultError) in
guard let error = resultError else {
return
}
}
// 3.10.18 이상
///////////////
let linker = DAPAppLinker()
let param = DAPAppLinkerCanStartParam()
param.scheme = "com.hanwha.Verify"
param.contents = "values"
linker.execute(with: param, completion: { (dict) in
}) { (resultError) in
}
///////////////
// 3.10.18 이하
///////////////
let linker = DAPAppLinker()
let iosDict = ["scheme" : "com.hanwha.Verify", "contents" : "values"]
let dictInfo = ["ios" : iosDict]
let params = [dictInfo] as [Any]
linker.execute(withActionName: "canstart", params: params, completion: { (dict) in
guard let resultDict = dict else {
return
}
}) { (resultError) in
guard let error = resultError else {
return
}
}
// 3.10.18 이상
DAPDeviceAPI *deviceAPI = [DAPAppLinker new];
DAPAppLinkerCanStartParam *infoParam = [DAPAppLinkerCanStartParam new];
infoParam.scheme = @"com.hanwha.Verify";
infoParam.contents = @"values";
[deviceAPI executeWithParam:infoParam completion:^(NSDictionary *resultDict) {
NSString *deviceResult = [resultDict objectForKey:kDeviceResult];
NSLog(@"deviceResult : %@", deviceResult);
} failure:^(NSError *error) {
NSLog(@"error : %@", [error userInfo]);
}];
// 3.10.18 이하
DAPDeviceAPI *deviceAPI = [DAPAppLinker new];
NSDictionary *iosDict = [NSDictionary dictionaryWithObjectsAndKeys:@"com.hanwha.Verify", @"scheme", @"values", @"contents", nil];
NSDictionary *dictInfo = [NSDictionary dictionaryWithObjectsAndKeys:iosDict, @"ios", nil];
NSArray *params = [NSArray arrayWithObjects:dictInfo, nil];
[deviceAPI executeWithActionName:@"canStart" params:params completion:^(NSDictionary *resultDict) {
NSString *result = [resultDict objectForKey:kDeviceResult];
if ([result isEqualToString:@"0"] == YES)
{
return;
}
} failure:^(NSError *error) {
}];
DAPDeviceAPI *deviceAPI = [DAPAppLinker new];
DAPAppLinkerCanStartParam *infoParam = [DAPAppLinkerCanStartParam new];
infoParam.scheme = @"com.hanwha.Verify";
infoParam.contents = @"values";
[deviceAPI executeWithParam:infoParam completion:^(NSDictionary *resultDict) {
NSString *deviceResult = [resultDict objectForKey:kDeviceResult];
NSLog(@"deviceResult : %@", deviceResult);
} failure:^(NSError *error) {
NSLog(@"error : %@", [error userInfo]);
}];
// 3.10.18 이하
DAPDeviceAPI *deviceAPI = [DAPAppLinker new];
NSDictionary *iosDict = [NSDictionary dictionaryWithObjectsAndKeys:@"com.hanwha.Verify", @"scheme", @"values", @"contents", nil];
NSDictionary *dictInfo = [NSDictionary dictionaryWithObjectsAndKeys:iosDict, @"ios", nil];
NSArray *params = [NSArray arrayWithObjects:dictInfo, nil];
[deviceAPI executeWithActionName:@"canStart" params:params completion:^(NSDictionary *resultDict) {
NSString *result = [resultDict objectForKey:kDeviceResult];
if ([result isEqualToString:@"0"] == YES)
{
return;
}
} failure:^(NSError *error) {
}];
JSON Format
호출 인자 정보는 다음과 같다.
{
"ios" : {
"scheme": "com.hanwha.Verify",
"contents": "values"
}
}
"ios" : {
"scheme": "com.hanwha.Verify",
"contents": "values"
}
}
파라미터 | 설명 |
---|---|
scheme | 실행시킬 앱의 번들 명 |
contents | 실행시킬 앱에게 전달 할 데이터 |