获取应用程序信息.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);
}];
}
*/
获取应用程序信息.h的更多相关文章
- Android中获取应用程序(包)的信息----PackageManager
本节内容是如何获取Android系统中应用程序的信息,主要包括packagename.label.icon.占用大小等.具体分为两个 部分,计划如下: 第一部分: 获取应用程序的packagena ...
- Android中获取应用程序(包)的信息-----PackageManager的使用(一)
本节内容是如何获取Android系统中应用程序的信息,主要包括packagename.label.icon.占用大小等.具体分为两个 部分,计划如下: 第一部分: 获取应用程序的packagenam ...
- Android中获取应用程序(包)的信息-----PackageManager的使用
本节内容是如何获取Android系统中应用程序的信息,主要包括packagename.label.icon.占用大小等.具体分为两个 部分,计划如下: 第一部分: 获取应用程序的packagename ...
- 【转】Android中获取应用程序(包)的信息-----PackageManager的使用(一)
转载请注明出处:http://blog.csdn.net/qinjuning 本节内容是如何获取Android系统中应用程序的信息,主要包括packagename.label.icon.占 ...
- Android中获取应用程序(包)的大小-----PackageManager的使用(二)
通过第一部分<<Android中获取应用程序(包)的信息-----PackageManager的使用(一)>>的介绍,对PackageManager以及 AndroidMani ...
- 一步一步实现web程序信息管理系统之三----登陆业务逻辑实现(验证码功能+参数获取)
本篇紧接着上一篇文章[一步一步实现web程序信息管理系统之二----后台框架实现跳转登陆页面] 验证码功能 一般验证码功能实现方式为,前端界面访问一个url请求,后端服务代码生成一个图片流返回至浏览器 ...
- 一起学android之怎样获取手机程序列表以及程序相关信息并启动指定程序 (26)
效果图: 程序列表: watermark/2/text/aHR0cDovL2Jsb2cuY3Nkbi5uZXQvaGFpX3FpbmdfeHVfa29uZw==/font/5a6L5L2T/fonts ...
- Android实现获取应用程序相关信息列表的方法
本文所述为Androdi获取手机应用列表的方法,比如获取到Android应用的软件属性.大小和应用程序路径.应用名称等,获取所有已安装的Android应用列表,包括那些卸载了的,但没有清除数据的应用程 ...
- 微信小程序授权获取用户详细信息openid
小程序获取用户的头像昵称openid之类 第一种使用wx.getUserInfo直接获取微信头像,昵称 wx.getUserInfo({ success: function (res) { that. ...
随机推荐
- 关于 unsigned 型变量在计算过程中发生的事情
运行环境:CentOS release 5.8 (Final) #include<stdio.h> #include<iostream> using namespace std ...
- install vim-powerline
1, install pip dnf install python-pip 2,install powerline-status pip install git+git://github.com/Lo ...
- sqlserver 存储过程分页管理
-- =============================================-- Author: <Author:刘畅>-- Create date: <Cre ...
- 数据结构-图-Java实现:有向图 图存储(邻接矩阵),最小生成树,广度深度遍历,图的连通性,最短路径1
import java.util.ArrayList; import java.util.List; // 模块E public class AdjMatrixGraph<E> { pro ...
- SparkMLlib之 logistic regression源码分析
最近在研究机器学习,使用的工具是spark,本文是针对spar最新的源码Spark1.6.0的MLlib中的logistic regression, linear regression进行源码分析,其 ...
- javascript获取asp.net服务器端控件的值
代码如下: <%@ Page Language="C#" CodeFile="A.aspx.cs" Inherits="OrderManage_ ...
- 好文mark
用oracle的dblink连接mysql. http://f.dataguru.cn/thread-267150-1-1.html hadoop的机架感知: 本地化策略,以及备份都要知道哪个节点在哪 ...
- android layout_weight讲解
Layout_weight是线性布局,也就是LinearLayout里面用到的,下面通过实验来看这个Layout_weight的特性. 1.当控件的属性android:layout_width=&qu ...
- word常用操作
[Word2003文档添加个行号] 参考:http://jingyan.baidu.com/article/e9fb46e1ca1d3c7520f7666f.html#333225-tsina-1-5 ...
- BZOJ 1537 二维偏序
#include <iostream> #include <cstring> #include <cstdio> #include <algorithm> ...