您的位置:首页 > 移动开发 > IOS开发

ionic-v1.7.12-ios版修改

2016-01-08 13:57 525 查看

1.打开其他应用(window.open(‘xxx://xxx’)),在plist文件添加:

<key>LSApplicationQueriesSchemes</key>
<array>
<string>com.xxx.otherapp1</string>
<string>com.xxx.otherapp2</string>
<string>com.xxx.otherapp3</string>
</array>


2.让其他应用打开自己,在plist文件添加:

<key>CFBundleURLTypes</key>
<array>
<dict>
<key>CFBundleURLName</key>
<string>auth</string>
<key>CFBundleURLSchemes</key>
<array>
<string>com.xxx.myapp</string>
</array>
</dict>
</array>


3.访问非https类网站(ionic-v1.7.12生成的代码中已经包含)

<key>NSAppTransportSecurity</key>
<dict>
<key>NSAllowsArbitraryLoads</key>
<true/>
</dict>


4.添加退出指令(zscmd::exitapp),MainViewController.m中shouldStartLoadWithRequest加上

html中使用window.open(“zscmd::exitapp”)退出应用

NSString *requestString = [[request URL] absoluteString];

NSArray *components = [requestString componentsSeparatedByString:@"::"];
if (components != nil && [components count] > 0) {
NSString *pocotol = [components objectAtIndex:0];
if ([pocotol isEqualToString:@"zscmd"]) {
NSString *commandStr = [components objectAtIndex:1];
NSLog(@"commmand:%@", commandStr);
if([commandStr isEqualToString:@"exitapp"]){
exit(0);
}
return NO;
}
}
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签:  ionic-ios