//
Gets the application information. h
iOS notes
//
Generally used to determine if there is a new version, whether it is necessary to force the update
The version number of iOS, which is called version, is called Build, and both values can be selected in Xcode and then clicked "Summary" to see. The key for version in the plist file is "cfbundleshortversionstring", which is the same as the version number on AppStore, and the key to build in Plist is "cfbundleversion". Represents the version number of build, which should be incremented by 1 after each build. Both of these values can be obtained in the program through the following code:
[[[NSBundle Mainbundle] infodictionary] valueforkey:@ "key"]
[2] Concrete implementation
The code implementation obtains the Verison number of the application:
[[[NSBundle Mainbundle] infodictionary] objectforkey:@ "cfbundleshortversionstring"] or [[NSBundle MainBundle] objectforinfodictionarykey:@ "Cfbundleshortversionstring"];
Get Build Number:
[[[NSBundle Mainbundle] infodictionary] objectforkey:@ "Cfbundleversion"]
Print out the contents of 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 get application information in AppStore
Refer to Apple's documentation: www.apple.com/itunes/affiliates/resources/documentation/itunes-store-web-service-search-api.html
The steps are as follows:
1, send the request by POST:
Http://itunes.apple.com/search?term= your application name &entity=software
A more accurate approach is to look for the app's ID:
Http://itunes.apple.com/lookup?id= the ID of your app
/*
Afhttprequestoperationmanager *mgr = [Afhttprequestoperationmanager manager];
Mgr.responseserializer = [Afjsonresponseserializer serializer];
Mgr.responseSerializer.acceptableContentTypes = [Nsset setwithobject:@ "Text/javascript"];
NSLog (@ "xxx");
Send a POST request
[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");
Send a POST request
[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);
}];
}
*/
Gets the application information. h