swift之获取APP各种参数和device参数、获取APPstore信息、以及跳转到appstore
2018-02-26 17:47
891 查看
APP的名称:let appName: String = NSBundle.mainBundle().objectForInfoDictionaryKey("CFBundleName")as!String?
=========APP应用的信息=========
let infoDic = Bundle.main.infoDictionary //bundleID let bundId=Bundle.main.bundleIdentifier // 获取App的版本号---version(上线的版本号) let appVersion = infoDic?["CFBundleShortVersionString"]! // 获取App的build版本 let appBuildVersion = infoDic?["CFBundleVersion"]! // 获取App的名称 let appName = infoDic?["CFBundleName"]! // app名称name,当displayname存在时,name显示为override,displayname不存在时,name正常显示 let appDispaleyname=infoDic?["CFBundleDisplayName"]!
==========UIDevice设备信息=========//系统名---iosUIDevice.init().systemName//系统版本UIDevice.init().systemVersion//设备名称----lambo的mac air let name=UIDevice.init().name//设备唯一标示符 let identi:String=(UIDevice.init().identifierForVendor?.uuidString)!//设备的型号--iphone、ipad let model=UIDevice.init().model
//地方型号,国际化名称
let loaclname=UIDevice.init().localizedModel
=============跳转到appstore========
//评论页面的地址:http://itunes.apple.com/WebObjects/MZStore.woa/wa/viewContentsUserReviews?id=1077712062&pageNumber=0&sortOrdering=2&type=Purple+Software&mt=8//详情页面的地址---如果不起效果:将 http:// 替换为 itms:// 或者 itms-apps://,注意用真机才有效果let urs="https://itunes.apple.com/cn/app/圣经-法语和英语对照-有声版/id735917884?mt=12" let url:URL?=URL.init(string: urs) UIApplication.shared.open(url!, options: [:], completionHandler: nil)
===============获取appstore中应用的信息========
要么改成https,
要么info.plist加NSAppTransportSecurity.NSAllowsArbitraryLoads = true,
获取信息的地址:
let appidStr:String="735917884" let appurlStr:String=String.init(format: "https://itunes.apple.com/cn/lookup?id=%@", appidStr) let url:URL=URL.init(string: appurlStr)! do{ let jsonData=try Data.init(contentsOf: url) let json=try JSONSerialization.jsonObject(with: jsonData, options: []) as! [String:Any] let res=json["results"]//APPstore信息 }catch{ }
=========APP应用的信息=========
let infoDic = Bundle.main.infoDictionary //bundleID let bundId=Bundle.main.bundleIdentifier // 获取App的版本号---version(上线的版本号) let appVersion = infoDic?["CFBundleShortVersionString"]! // 获取App的build版本 let appBuildVersion = infoDic?["CFBundleVersion"]! // 获取App的名称 let appName = infoDic?["CFBundleName"]! // app名称name,当displayname存在时,name显示为override,displayname不存在时,name正常显示 let appDispaleyname=infoDic?["CFBundleDisplayName"]!
==========UIDevice设备信息=========//系统名---iosUIDevice.init().systemName//系统版本UIDevice.init().systemVersion//设备名称----lambo的mac air let name=UIDevice.init().name//设备唯一标示符 let identi:String=(UIDevice.init().identifierForVendor?.uuidString)!//设备的型号--iphone、ipad let model=UIDevice.init().model
//地方型号,国际化名称
let loaclname=UIDevice.init().localizedModel
=============跳转到appstore========
//评论页面的地址:http://itunes.apple.com/WebObjects/MZStore.woa/wa/viewContentsUserReviews?id=1077712062&pageNumber=0&sortOrdering=2&type=Purple+Software&mt=8//详情页面的地址---如果不起效果:将 http:// 替换为 itms:// 或者 itms-apps://,注意用真机才有效果let urs="https://itunes.apple.com/cn/app/圣经-法语和英语对照-有声版/id735917884?mt=12" let url:URL?=URL.init(string: urs) UIApplication.shared.open(url!, options: [:], completionHandler: nil)
===============获取appstore中应用的信息========
要么改成https,
要么info.plist加NSAppTransportSecurity.NSAllowsArbitraryLoads = true,
获取信息的地址:
let appidStr:String="735917884" let appurlStr:String=String.init(format: "https://itunes.apple.com/cn/lookup?id=%@", appidStr) let url:URL=URL.init(string: appurlStr)! do{ let jsonData=try Data.init(contentsOf: url) let json=try JSONSerialization.jsonObject(with: jsonData, options: []) as! [String:Any] let res=json["results"]//APPstore信息 }catch{ }
相关文章推荐
- IOS--OC获取app应用版本的信息和当前设备的各种信息,跳转到appstore(二)
- 获取appstore版本号,本机app版本号,以及跳转appstore整理
- iOS开发之app之间的跳转以及跳转到appstore
- Swift - 纯代码实现页面segue跳转,以及参数传递
- 转:从AppStore获取一个iOS App的版本信息
- 从AppStore获取一个iOS App的版本信息
- Android 获取设备各种信息以及其它
- iOS 获取appStore的链接地址,从app中跳转 appStore中应用
- Android 获取设备各种信息以及其它
- Request获取url信息以及url带的参数
- ios开发之 获取APP版本号/跳转APPStore(下载页/评论页)
- Request获取url信息以及url带的参数
- Jquery跳转页面传递参数以及获取url的参数
- IPHONE IOS的ANCS推送信息,获取信息的APP名字、标题以及内容
- 转:从AppStore获取一个iOS App的版本信息
- iOS 获取当前APP在APPStore上的版本信息等
- iOS中获取设备数据以及如何获取应用信息之UIDevice的用法
- 在web中判断是否有app,没有则跳转,包括读取a标签参数,获取后台数据
- iOS计算App缓存的大小以及清理、iOS应用跳转到appstore评分、文字加阴影、 NSMutableArray到NSData的转化