Xcode 5您的二进制文件未针对验证时的iPhone 5错误进行优化 [英] Xcode 5 Your binary is not optimized for iPhone 5 error while validating

查看:67
本文介绍了Xcode 5您的二进制文件未针对验证时的iPhone 5错误进行优化的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我遇到了Your binary is not optimized for iPhone 5错误:

我尝试了其他问题中建议的所有解决方案,但没有任何效果.总结:

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

我在项目的根目录中有一个尺寸为640××1136的Default-568h@2x.png图像,其中project_name.xcodeproj是.

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.

根据一个建议,我将Default.png(640××136)和Default~iphone.png(640××960)添加到了同一目录.没用

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.

这是最奇怪的部分:这是应用程序的1.1版.我正在使用具有相同图像的相同.xcodeproj.第一次验证没有问题,但现在没有.有任何想法吗?

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?

推荐答案

使用全局图像资产来控制图像是否正确,并查看是否存在警告.

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

为了将来更好,在最后一个Xcode中使用一个故事板屏幕:

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

要以通用模式打开您的应用,请执行以下操作:

To turn your app in universal mode:

在自动布局模式下添加Storybord或使用StoryBorad.

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

要使用多个情节提要,您可以在application didFinishLaunchingWithOptions中的AppDelegate中使用它:

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];
        }
    }

您可以添加所有分辨率的iPhone 4s/5(s/c)6和6 Plus

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

在您的<AppName>-Prefix.pch中定义所有分辨率,如下所示:

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 )

然后在您的项目中调用该函数,例如,一个用于iPhone 4/5和iPad的滚动视图:

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

这篇关于Xcode 5您的二进制文件未针对验证时的iPhone 5错误进行优化的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆