The automatic Version Detection Method After the ios application is started, and the ios application Detection Method
Today, it was unexpectedly discovered that appstore still provides links to obtain client information in json format through url:
Http://itunes.apple.com/lookup? Id = $ id
This address can be used to obtain the icon, description, version number, and version description of an application.
For example, the json information of the Request secret:
Java code
- Http://itunes.apple.com/lookup? Id = 839415177
Java code
- {
- "ResultCount": 1,
- "Results ":[
- {"Kind": "software", "features": [],
- "SupportedDevices": ["ipodtouchstmthgen", "iPad2Wifi", "iPadFourthGen", "iPadFourthGen4G", "iPadMini4G", "iPadThirdGen", "iPadMini", "iPhone5 ", "iPhone5c", "iPad23G", "iPhone4", "iPhone4S", "iPadThirdGen4G", "iPhone5s"], "isGameCenterEnabled": false,
- "ScreenshotUrls": ["http://a4.mzstatic.com/us/r30/Purple4/v4/3f/ee/08/3fee086d-cd99-2ac0-2159-99372c989ad3/screen1136x1136.jpeg", "http://a3.mzstatic.com/us/r30/Purple6/v4/07/a6/2d/07a62d2a-0bdc-ae5f-2239-532c364e9641/screen1136x1136.jpeg", "http://a2.mzstatic.com/us/r30/Purple4/v4/3f/e0/ca/3fe0ca8d-67bd-2923-d3c1-797dd362c0cb/screen1136x1136.jpeg", "http://a2.mzstatic.com/us/r30/Purple6/v4/4a/0d/9f" /Examples/screen1136x1136.jpeg "," http://a1.mzstatic.com/us/r30/Purple4/v4/04/7b/63/047b63d5-1f09-04fd-1c5c-3fabf45b33fc/screen1136x1136.jpeg "]," ipadScreenshotUrls ": []," artworkUrl60 ":" http://a1246.phobos.apple.com/us/r30/Purple/v4/c9/71/71/c97171eb-c2f9-4b13-378d-d5cfdde611b4/Icon.png "," artworkUrl512 ":" http://a1418.phobos.apple.com/us/r30/Purple/v4/33/d0/63/33d063f6- C2d1-a2fd-4490-d2ab86ac071b/mzl.cctcjnum.png "," artistViewUrl ":" https://itunes.apple.com/us/artist/shenzhen-wumii-technology/id593518769? Uo = 4 "," artistId ": 593518769," artistName ":" Shenzhen Wumii Technology Limited "," price ": 0.00," version ":" 1.1 ",
- "Description": "" secret "is an anonymous version of the circle of friends. You can share secrets, gossip, breaking news, truth, and so on with friends without any scruples! \ N "secret" is neither a tree hole nor a float bottle \ n the secret you see comes from your friends! \ N Similarly, the secrets you send will also be displayed to your friends, so that the people most concerned about you can give feedback to you! \ N "secret" allows you to take a mask, unload your identity \ n, and post and comment anonymously, as if you and your friends are wearing a mask and are attending a masked party! Friends can speak freely after removing their identities! \ N [main functions] \ n \ n1. view secrets from friends \ n2. anonymously publish secrets and comments \ n3. supports exquisite graphic layout \ n4. extremely strict privacy protection \ n \ n [when all friends are anonymous, what will they do?] \ N in the circle of friends: \ n "It's still comfortable for the BMW 5 series. It's time to say goodbye to my Audi A4 !」 \ N in secret: \ n "when I woke up early in the morning, I was carrying various loans for mortgage loans and car loans. The pressure was so high that I was so tired of living !」 \ N in the circle of friends: \ n "It is my greatest happiness to open your eyes and say good morning to my husband every day !」 \ N in secret: \ n "three years ago, I took to the Second Yangtze River Bridge and planned to end my life, but he stayed. He is my husband now .」 \ N more friends secret, wait for you to find \ u2026 \ u2026 \ n official Weibo: @ secret App "," currency ":" USD ", "genres": ["Social Networking", "Lifestyle"], "genreIds": ["6005", "6012"], "releaseDate": "2014-04-04T09: 58: 58Z "," sellerName ":" Shenzhen Wumii Technology Limited "," bundleId ":" com. wumii. ios. WMMimi "," trackId ": 839415177," trackName ":" secret-Anonymous news in the circle of friends "," primaryGenreName ":" Social Networking "," primaryGenreId ": 6005, "releaseNotes": "-added the password reset function \ N-New Comment display floor \ n-support for international mobile phone number registration login \ n-improve application stability "," formattedPrice ":" Free "," wrapperType ":" software ", "trackCensoredName": "secret-Anonymous news in the circle of friends", "languageCodesISO2A": ["EN", "ZH"], "fileSizeBytes": "15325961", "contentAdvisoryRating ": "12 +", "averageUserRatingForCurrentVersion": 4.0, "userRatingCountForCurrentVersion": 16, "artworkUrl100": "http://a1418.phobos.apple.com/us/r30/Purple/v4/33/d0/63/33d063f6-c2d1-a2fd-4490-d2 Ab86ac071b/mzl.cctcjnum.png "," trackViewUrl ":" https://itunes.apple.com/us/app/mi-mi-peng-you-quan-ni-ming/id839415177? Mt = 8 & uo = 4 "," trackContentRating ":" 12 + "," averageUserRating ": 4.0," userRatingCount ": 26}]
- }
Recall that the previous ios version detection was a client-side request server. The server returns the latest version information and provides new instructions. In addition, the server needs to maintain an ios version update record, which actually complicate the UPDATE function;
Later ios version updates can be used:
1. Only one appstore id is maintained in the background
2. Each time the client detects an upgrade, it directly requests the appstore to obtain the appstore version information and locally determines whether a new version exists. If yes, an update is prompted.
How to identify the direction of ios startup
Because apple requires ipad applications to provide at least portrait and landscape support, it is essential to detect the current direction of the device in the program. Generally, you can use:
1 [[UIDevice currentDevice] orientation:
1UIDeviceOrientationUnknown: This is unable to determine the device direction. If we want to write the information about the device direction when the program starts, what should we do?
In fact, you can obtain the direction of the controller to which the control belongs, so that the direction of the control is consistent with that of the controller, regardless of the current device direction. For example:
View sourceprint? 1if (self. interfaceOrientation = UIDeviceOrientationPortrait)
You can determine whether the program is in the protrait direction at startup.
Youhaodeyi
How can I determine whether a program is started horizontally or vertically?
When the iPad program is started, it is in the vertical direction by default. Even if it is placed in the horizontal direction, it is also in the vertical direction after it is started. How can I know whether the iPad is placed horizontally or vertically after the program is started?
Danyitianshi
There is a class called UIDevice, which has a property UIDeviceOrientation, which should be available when the program is started, but I have never used it. I just recommend that you do not mislead it.
Blackiron
Use interfaceOrientation for judgment, such as my
Force-level code:
Copy code
// Override to allow orientations other than the default portrait orientation.
-(BOOL) shouldAutorotateToInterfaceOrientation :( UIInterfaceOrientation) interfaceOrientation {
If (interfaceOrientation = UIInterfaceOrientationLandscapeLeft | interfaceOrientation = UIInterfaceOrientationLandscapeRight ){
Return YES;
}
Return NO;
}
Youhaodeyi
If the iPad is horizontally placed at startup, the size of the root view when the program is started is the size of the vertical placement, and the size of the horizontal placement is changed after the user refreshes the page, how can I set the program to the size when it is placed horizontally when it comes up? I see in the ios document that the iPad is started vertically by default.
Zhangxi_1989 2011-02-10 09:50
If (interfaceOrientation = UIInterfaceOrientationLandscapeLeft | interfaceOrientation = UIInterfaceOrientationLandscapeRight ){
Return YES;
} Else
{
Return NO;
}
In this way, you can.
Domob
Inf ...... remaining full text>
Question about starting another iOS app
This is a problem with the code of application B, and the startup method is not perfect.