0

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

Error message

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?

Eddy
  • 3,533
  • 13
  • 59
  • 89

5 Answers5

2

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:

enter image description here

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 ;)

BlackSheep
  • 1,087
  • 12
  • 29
1

Check wheter the images are added to target files

madhu
  • 961
  • 9
  • 21
0

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

Atif Imran
  • 1,899
  • 2
  • 18
  • 33
0

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.

Urmi
  • 344
  • 1
  • 14
  • how do you mean "check for framing of all your views"? Obviously I made sure they look good for both sizes. Is there a formal standard, or criteria? – Eddy Sep 29 '14 at 09:40
  • yup i know you have checked all, but if by mistake some views are missing to check framing. and for what you have asked for standard & criteria? – Urmi Sep 29 '14 at 10:53
  • Do you have an example of something that was a problem and you fixed it? I'm still not sure what do you mean. – Eddy Sep 30 '14 at 12:17
0

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

Eddy
  • 3,533
  • 13
  • 59
  • 89