Xcode 5 Your binary is not optimized for iPhone 5 error while validating

六月ゝ 毕业季﹏ 提交于 2019-12-08 09:31:32

问题


I'm running into the Your binary is not optimized for iPhone 5 error:

I tried every solution suggested in the other questions but nothing works. To summarize:

I have the Default-568h@2x.png image with a size of 640 × 1136 in the root directory of the project, where project_name.xcodeproj is.

Following one advice, I added Default.png (640 × 1136) and Default~iphone.png (640 × 960) to the same directory. Didn't work.

I am using an asset catalog with the proper sizes in place.

Here's the strangest part: this is a version 1.1 of the application. I'm using the same .xcodeproj with the same images. It validated with no issues the first time, but now it doesn't. Any ideas?


回答1:


Using the image asset global to control if the image is correct, and see if there is the warning.

For the future is better using with last Xcode a storyboard screen:

To turn your app in universal mode:

add a storybord or using a StoryBorad in Auto Layout mode.

To use multiple storyboard you can use this in your AppDelegate inside a application didFinishLaunchingWithOptions:

#pragma mark - Universal storyboard.

    if(UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPhone){
        UIStoryboard *storyBoard;

        CGSize result = [[UIScreen mainScreen] bounds].size;
        CGFloat scale = [UIScreen mainScreen].scale;
        result = CGSizeMake(result.width *scale, result.height *scale);

        if(result.height <= 960){
            storyBoard = [UIStoryboard storyboardWithName:@"iPhone4" bundle:nil];
            UIViewController *initViewController = [storyBoard instantiateInitialViewController];
            [self.window setRootViewController:initViewController];
        }
    }

You can add all resolution iPhone 4s / 5 (s/c) 6 and 6 Plus

In your <AppName>-Prefix.pch define all resolutions like this:

#define   IsIphone5     ( fabs( ( double )[ [ UIScreen mainScreen ] bounds ].size.height - ( double )568 ) < DBL_EPSILON )
#define   IsIphone4     ( fabs( ( double )[ [ UIScreen mainScreen ] bounds ].size.height - ( double )480 ) < DBL_EPSILON )

Then call the function in your project, for example one scrollview for iPhone 4/5 and iPad:

- (void)spiegaScroll{

    if (IsIphone5){

    CGRect scrollFrame;
    scrollFrame.origin = myScroll.frame.origin;
    scrollFrame.size = CGSizeMake(320, 568);
    spiega.frame = scrollFrame;
    [spiega setContentSize:CGSizeMake(320, 1100)];
    myScroll.scrollEnabled = YES;
    myScroll.pagingEnabled = NO;
    myScroll.clipsToBounds = NO;

    } else if (IsIphone4) {

        CGRect scrollFrame;
        scrollFrame.origin = myScroll.frame.origin;
        scrollFrame.size = CGSizeMake(320, 480);
        spiega.frame = scrollFrame;
        [spiega setContentSize:CGSizeMake(320, 1100)];
        myScroll.scrollEnabled = YES;
        myScroll.pagingEnabled = NO;
        myScroll.clipsToBounds = NO;

    } else {

//the rest is iPad in this case

        CGRect scrollFrame;
        scrollFrame.origin = myScroll.frame.origin;
        scrollFrame.size = CGSizeMake(768, 1024);
        spiega.frame = scrollFrame;
        [spiega setContentSize:CGSizeMake(768, 2094)];
        myScroll.scrollEnabled = YES;
        myScroll.pagingEnabled = NO;
        myScroll.clipsToBounds = NO;
    }

}

Hope this help you for now or for your future apps ;)




回答2:


Check wheter the images are added to target files




回答3:


In your plist file set the value for your images in the icon set dictionary.




回答4:


Having same issue. finally i found solution from Iphone 5 Launch Image Problem

please make sure the 568h file is in PNG format? Also make sure that you provided support for iphone 5 for all your screens? Only adding Default-568h@2x.png is not gaurantee for iphone 5 support. You have to check for framing of all your view for iphone 3.5" and 4" device.




回答5:


Well, looks like the problem went away once I upgraded to xCode 6. The app validated with no issues.



来源:https://stackoverflow.com/questions/26087160/xcode-5-your-binary-is-not-optimized-for-iphone-5-error-while-validating

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!