日韩性视频-久久久蜜桃-www中文字幕-在线中文字幕av-亚洲欧美一区二区三区四区-撸久久-香蕉视频一区-久久无码精品丰满人妻-国产高潮av-激情福利社-日韩av网址大全-国产精品久久999-日本五十路在线-性欧美在线-久久99精品波多结衣一区-男女午夜免费视频-黑人极品ⅴideos精品欧美棵-人人妻人人澡人人爽精品欧美一区-日韩一区在线看-欧美a级在线免费观看

歡迎訪問 生活随笔!

生活随笔

當前位置: 首頁 > 编程资源 > 编程问答 >内容正文

编程问答

获取应用程序信息.h

發布時間:2024/7/19 编程问答 28 豆豆
生活随笔 收集整理的這篇文章主要介紹了 获取应用程序信息.h 小編覺得挺不錯的,現在分享給大家,幫大家做個參考.

//
//? 獲取應用程序信息.h
//? IOS筆記
//

一般會用來判斷是否有新版本、是否需要強制更新

iOS的版本號,一個叫做Version,一個叫做Build,這兩個值都可以在Xcode 中選中target,點擊“Summary”后看到。 Version在plist文件中的key是“CFBundleShortVersionString”,和AppStore上的版本號保持一致,Build在plist中的key是“CFBundleVersion”,代表build的版本號,該值每次build之后都應該增加1。這兩個值都可以在程序中通過下面的代碼獲得:

[[[NSBundle mainBundle] infoDictionary] valueForKey:@"key"]


[2]具體實現
代碼實現獲得應用的Verison號:
[[[NSBundle mainBundle] infoDictionary] objectForKey:@"CFBundleShortVersionString"]或[[NSBundle mainBundle] objectForInfoDictionaryKey:@"CFBundleShortVersionString"];
獲得build號:
[[[NSBundle mainBundle] infoDictionary] objectForKey:@"CFBundleVersion"]



打印出來infoDictionary的內容
??? NSLog(@"%@",[[NSBundle mainBundle]infoDictionary]);
{
??? BuildMachineOSBuild = 15B42;
??? CFBundleDevelopmentRegion = en;
??? CFBundleExecutable = "UIApplication\U7684\U4f7f\U7528";
??? CFBundleIdentifier = "cn.juzhong.UIApplication---";
??? CFBundleInfoDictionaryVersion = "6.0";
??? CFBundleInfoPlistURL = "Info.plist -- file:///Users/liuweicheng/Library/Developer/CoreSimulator/Devices/1A2BA12B-DF68-48F4-995A-C6AC2701D3AE/data/Containers/Bundle/Application/1543AEC3-3B92-4282-896E-C3A1D8E99E33/UIApplication%E7%9A%84%E4%BD%BF%E7%94%A8.app/";
??? CFBundleName = "UIApplication\U7684\U4f7f\U7528";
??? CFBundleNumericVersion = 16809984;
??? CFBundlePackageType = APPL;
??? CFBundleShortVersionString = "1.0";
??? CFBundleSignature = "????";
??? CFBundleSupportedPlatforms =???? (
????????????????????????????????????? iPhoneSimulator
????????????????????????????????????? );
??? CFBundleURLTypes =???? (
??????????????????????????? {
??????????????????????????????? CFBundleURLName = "";
??????????????????????????? }
??????????????????????????? );
??? CFBundleVersion = 1;
??? DTCompiler = "com.apple.compilers.llvm.clang.1_0";
??? DTPlatformBuild = "";
??? DTPlatformName = iphonesimulator;
??? DTPlatformVersion = "9.1";
??? DTSDKBuild = 13B137;
??? DTSDKName = "iphonesimulator9.1";
??? DTXcode = 0711;
??? DTXcodeBuild = 7B1005;
??? LSRequiresIPhoneOS = 1;
??? MinimumOSVersion = "9.1";
??? NSAppTransportSecurity =???? {
??????? NSAllowsArbitraryLoads = 1;
??? };
??? UIDeviceFamily =???? (
????????????????????????? 1
????????????????????????? );
??? UILaunchStoryboardName = LaunchScreen;
??? UIMainStoryboardFile = Main;
??? UIRequiredDeviceCapabilities =???? (
??????????????????????????????????????? armv7
??????????????????????????????????????? );
??? UISupportedInterfaceOrientations =???? (
??????????????????????????????????????????? UIInterfaceOrientationPortrait,
??????????????????????????????????????????? UIInterfaceOrientationLandscapeLeft,
??????????????????????????????????????????? UIInterfaceOrientationLandscapeRight
??????????????????????????????????????????? );
}




iOS獲取AppStore內應用程序信息

參考 apple的文檔:www.apple.com/itunes/affiliates/resources/documentation/itunes-store-web-service-search-api.html

具體步驟如下:

1,用 POST 方式發送請求:

http://itunes.apple.com/search?term=你的應用程序名稱&entity=software

更加精準的做法是根據 app 的 id 來查找:

http://itunes.apple.com/lookup?id=你的應用程序的ID

/*
AFHTTPRequestOperationManager *mgr = [AFHTTPRequestOperationManager manager];

mgr.responseSerializer = [AFJSONResponseSerializer serializer];

mgr.responseSerializer.acceptableContentTypes = [NSSet setWithObject:@"text/javascript"];

NSLog(@"xxx");

//發送POST請求
[mgr POST:@"http://itunes.apple.com/search?term=QQ&entity=software" parameters:nil? success:^(AFHTTPRequestOperation *operation, id responseObject) {
??? NSLog(@"%@",responseObject);
} failure:^(AFHTTPRequestOperation *operation, NSError *error) {
??? NSLog(@"%@",error);
}];

AFHTTPRequestOperationManager *mgr1 = [AFHTTPRequestOperationManager manager];
mgr1.responseSerializer = [AFJSONResponseSerializer serializer];
mgr1.responseSerializer.acceptableContentTypes = [NSSet setWithObject:@"text/javascript"];
NSLog(@"xxx");
//發送POST請求
[mgr1 POST:@"http://itunes.apple.com/lookup?id=com.tenpay.mobile.iphone" parameters:nil? success:^(AFHTTPRequestOperation *operation, id responseObject) {
??? NSLog(@"%@",responseObject);
} failure:^(AFHTTPRequestOperation *operation, NSError *error) {
?? ?
??? NSLog(@"%@",error);
}];
}
*/


轉載于:https://www.cnblogs.com/er-dai-ma-nong/p/5045703.html

總結

以上是生活随笔為你收集整理的获取应用程序信息.h的全部內容,希望文章能夠幫你解決所遇到的問題。

如果覺得生活随笔網站內容還不錯,歡迎將生活随笔推薦給好友。