Explore the impact of different versions of the SDK on iOS programs

Source: Internet
Author: User

Conclusion:the same code, compiled with different versions of the SDK, affects the values in the macho header, which makes the program look different. Code:@implementation appdelegate
-(BOOL) Application: (UIApplication *) application didfinishlaunchingwithoptions: (nsdictionary *) launchOptions
{
UIScreen *mainscreen = [UIScreen mainscreen];
cgrect frm = [mainscreen bounds];
UIWindow *win = [[UIWindow alloc] initwithframe:frm];
Win.backgroundcolor = [Uicolor bluecolor];
Self.window = win;
[win release];
[Self.window makekeyandvisible];
return YES;
}
</pre></div><div><pre name= "code" class= "OBJC" >
@end

Problem:such as the code is very simple, no function, respectively, using Xcode v4.6.3 and v5.0.2 compiled, and then installed on the IOS8 device, the performance is different, mainly iOS6 and iOS7 about the difference between the state bar, such as:
the code is the same, just use a different SDK to compile, where is the difference? Description:
Xcode version: 4.6.3 VS 5.0.2 device: IPhone 5s,ios 8.0 executable file name: apidiff-sdk61 represents an executable file compiled with iOS SDK 6.1 apidiff-sdk70 represents an executable file compiled with iOS SDK 7.0 IPA file name: Apidiff-sdk61.ipa represents an IOS SDK 6.1 compiled installation package Apidiff-sdk70.ipa represents an iOS SDK 7.0 compiled installation package
Analysis:Analysis One: Confirmation is an executable program causedverification method: withApidiff-sdk70.ipato replace the executable program inApidiff-sdk61.ipain the executable program, and then use the Codesign command to re-sign, package, installed on the phone after the discovery status bar is transparent, stating that the difference is really in the executable program.

re-signing method:
Codesign-f-S "certificate name"--resource-rules payload/*.app/resourcerules.plist Payload/*.app


Analysis Two: Comparing binary differencessince in the executable file, the first thought is to use the binary comparison tool to see the difference between the two, the results such as:
you can see the difference is too big, so it makes no sense, this road is not feasible. Analysis Three: Compare code differencessince comparing binary doesn't make sense, let's compare the disassembly code to see if the compiler did something,
you can see that the code of the two is almost the same, the specific difference is also caused by different versions of the compiler, the logic is the same, so the code is not caused by the appearance of different programs. In addition, the code does not read any global variables, stating that it is not because there are any default values in Uikit that are compiled into the program, which causes the status bar to look different. Analysis Four: Compare the effect of Uikit version number on programsince the code is not different, we will first think about whether the program looks different due to the Uikit version. Although the program is a dynamically linked uikit, and there is only one version of the Uikit library on the device, we still want to verify it.
first determine the difference between the two, such as:

you can see that the version number is different, but the compatible version is 1.0, theoretically not because of this resulting in procedural differences. Theory is the theory, we are now using the exclusion method to determine the cause of the problem, or to real deal validation. Validation method: Change the Uikit version number in apidiff-sdk61 to 2903.23.0. Modify the method: This value in the binary file offset is: 0X6EC, you need to pay attention to the small end problem. Modified, re-signed, packaged and installed on the phone, found that the status bar has not changed, so the reason is not the difference between the Uikit version number. Analysis five: Using Machoview to compare by itemIt's a little out of the way to get here, the problem is there and we can't find the reason. That's the most primitive tool: manual labor, using Machoview as a comparison.
from "__linkedit"---> "lc_dyld_info_only"---> "lc_load_dylinker"---> "lc_version_min_iphoneos"
A difference in the reserved values was found in "Lc_version_min_iphoneos":
It feels possible this is the cause of the problem, to verify: Modify the apidiff-sdk61, offset address 0x69c, change the value to 00070000, re-signed, packaged and installed to the phone, found that the status bar becomes transparent, the problem is here! TODO: How this difference affects the appearance of the programHow this difference affects the appearance of the program may be due to:
1. This property will be read in Uikit. The probability is very small, uikit is just a library, and the difference above will be first obtained by the loader, far from the Uikit.
2, Springboard and related services. The possibility is big, ①:springboard several its service itself has the drawing responsibility; ②: Click on the diagram on the desktopThe program was started by springboard.

However, I do not intend to continue to verify that this has satisfied my desire to find, the more powerful brothers can continue to analyze. ^_^


Explore the impact of different versions of the SDK on iOS programs

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.