使用XCode 4.5运行iOS 5.1模拟器的问题 [英] Issues running iOS 5.1 simulator using XCode 4.5

查看:126
本文介绍了使用XCode 4.5运行iOS 5.1模拟器的问题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我最近将我的XCode升级到4.5版本,现在当我尝试将应用程序开发到iOS 5.0 / 5.1时,我遇到了问题。

I recently upgraded my XCode to 4.5 version and now I'm having problems when I try to develop applications to iOS 5.0/5.1.

我开发了一个简单的iPad用户需要将图像与对应的单词匹配的游戏。如果相关,所有这些项都存储在UIImageView中。支持的界面方向仅为横向。

I developed a simple iPad game where the user needs to match images with the correspondent words. All these items are stored in UIImageView, if that is relevant. The supported interface orientation is only landscape.

当我使用iPad 6.0 Simulator运行我的应用程序时,一切正常,没有任何问题。但是当我尝试使用5.1运行它时,一切都会出错。图像根本没有出现,我的背景图像出现在侧面并重复出现。状态栏也显示错误:设备方向为横向,但侧边栏显示在右侧。当我使用6.0模拟器时也不会发生这种情况。

When I run my application using iPad 6.0 Simulator everything works fine without any problem. But when I try to run it using 5.1, everything goes wrong. The images simply don't appear and my background image appears sideways and repeated. The status bar also appears wrongly: the device orientation is landscape, but the sidebar appears on the right side. This also doesn't happen when I use 6.0 simulator.

在项目详细信息中,我已经将iOS部署目标更改为5.1,以及故事板中。使用iOS 5.1部署目标,故事板不允许我选择使用Autolayout选项,因此我取消选择此选项。这是由此选项引起的吗?

In the project details I already changed the iOS Deployment Target to 5.1, as well in the Storyboard. Using iOS 5.1 deployment target the storyboard don't let me to select "Use Autolayout" option, so I deselected this option. Is this caused by this option?

我已经尝试在设备中运行我的应用程序,但结果是一样的。自从我安装XCode 4.5后,我开始遇到这类问题,因为例如我甚至无法在iOS 5.x模拟器中正确运行Master-detail Application模板,因为当我点击Add按钮时它会崩溃。

I already tried to run my application in a device, but the result is the same. Since I installed XCode 4.5 I started to have these kind of issues, since for example I can't even run a "Master-detail Application" template properly in iOS 5.x simulator, because it crashes when I click the "Add" button.

我是否遗漏了运行使用SDK 6创建的5.x应用程序的内容?我已经在很多论坛上搜索过,但我还没有找到解决这类问题的方法。我很乐意听取任何建议,因为我已经在这个问题上花了很多时间而且我已经没有选择了。

Am I missing something to run 5.x applications created using SDK 6? I already searched in a lot of forums but I haven't found any solution to this kind of problem yet. I'll be glad to ear any kind of suggestions, since I already lost lots of time around this issue and I'm running out of options.

:我记得一个可能与此问题相关的细节:我在故事板中的视图是一个自定义视图。我创建了一个从UIView扩展的类,以便我可以覆盖drawRect函数来在我的对象之间绘制线条。然后在Storyboard中,在View中,我刚刚在Custom Class - > Class中选择了我的类。

: I remembered a detail that maybe can be relevant for this problem: my view in storyboard is a custom view. I created a class that extends from UIView so that I could override drawRect function to draw lines between my objects. Then in Storyboard, in the View, I just selected my class in Custom Class -> Class.

我注意到当我运行5.1模拟器时,状态栏最初显示在顶部,然后当窗口加载时,它会向右移动。

I noticed that when I run 5.1 Simulator the status bar initially appears on the top and then when the window is loaded it goes to the right.

如果你想知道任何其他细节,请问我。

If you want to know any other detail please just ask me.

非常感谢。

推荐答案

英语不是我的母语,所以请原谅我的语法...

English isn't my native so please forgive my grammar...

至于你的主要细节添加按钮问题,这对我有用。

As far as your Master-detail "Add" button issue, this is what worked for me.

据我所知,该应用程序因以下原因崩溃:

From what I can tell, the app crashes because of:

[UITableView dequeueReusableCellWithIdentifier:forIndexPath:]: unrecognized selector sent to instance

快速帮助说:

- (id)dequeueReusableCellWithIdentifier:(NSString *)identifier forIndexPath:(NSIndexPath *)indexPath declaration is only available in iOS (6.0 and later).

所以我尝试更改MasterViewController.m中的代码:

So I tried changing the code in MasterViewController.m:

- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
    UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:@"Cell" forIndexPath:indexPath];
    [self configureCell:cell atIndexPath:indexPath];
    return cell;
}

Xcode在旧版本中使用的代码:

for code that Xcode used in older versions:

- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
    static NSString *CellIdentifier = @"Cell";

    UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier];
    if (cell == nil) {
        cell = [[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:CellIdentifier];

    }
    [self configureCell:cell atIndexPath:indexPath];
    return cell;
}

希望这有帮助。

这篇关于使用XCode 4.5运行iOS 5.1模拟器的问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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