简体   繁体   English

使用XCode 4.5运行iOS 5.1模拟器的问题

[英]Issues running iOS 5.1 simulator using XCode 4.5

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. 我最近将我的XCode升级到4.5版本,现在当我尝试将应用程序开发到iOS 5.0 / 5.1时,我遇到了问题。

I developed a simple iPad game where the user needs to match images with the correspondent words. 我开发了一款简单的iPad游戏,用户需要将图像与对应的单词进行匹配。 All these items are stored in UIImageView, if that is relevant. 如果相关,所有这些项都存储在UIImageView中。 The supported interface orientation is only landscape. 支持的界面方向仅为横向。

When I run my application using iPad 6.0 Simulator everything works fine without any problem. 当我使用iPad 6.0 Simulator运行我的应用程序时,一切正常,没有任何问题。 But when I try to run it using 5.1, everything goes wrong. 但是当我尝试使用5.1运行它时,一切都会出错。 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. 当我使用6.0模拟器时,这也不会发生。

In the project details I already changed the iOS Deployment Target to 5.1, as well in the Storyboard. 在项目详细信息中,我已经将iOS部署目标更改为5.1,以及故事板中。 Using iOS 5.1 deployment target the storyboard don't let me to select "Use Autolayout" option, so I deselected this option. 使用iOS 5.1部署目标,故事板不允许我选择“使用Autolayout”选项,因此我取消选择此选项。 Is this caused by this option? 这是由这个选项引起的吗?

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. 自从我安装XCode 4.5后,我开始遇到这类问题,因为例如我甚至无法在iOS 5.x模拟器中正确运行“Master-detail Application”模板,因为当我点击“Add”按钮时它会崩溃。

Am I missing something to run 5.x applications created using SDK 6? 我错过了运行使用SDK 6创建的5.x应用程序的东西吗? 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. 我很乐意听取任何建议,因为我已经在这个问题上浪费了很多时间,而且我已经没有选择了。

[EDIT] : 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. 我创建了一个从UIView扩展的类,以便我可以覆盖drawRect函数来在我的对象之间绘制线条。 Then in Storyboard, in the View, I just selected my class in Custom Class -> Class. 然后在Storyboard中,在View中,我刚刚在Custom Class - > Class中选择了我的类。

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

If you want to know any other detail please just ask me. 如果您想了解任何其他细节,请问我。

Thank you very much. 非常感谢你。

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. 至于你的Master-detail“添加”按钮问题,这对我有用。

From what I can tell, the app crashes because of: 据我所知,该应用程序因以下原因崩溃:

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

Quick Help says: 快速帮助说:

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

So I tried changing the code in MasterViewController.m: 所以我尝试更改MasterViewController.m中的代码:

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

for code that Xcode used in older versions: 对于Xcode在旧版本中使用的代码:

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

Hope this helps. 希望这可以帮助。

Have you checked your storyboard to make sure you have shut off Autolayout? 您是否检查了故事板以确保关闭了Autolayout? Autolayout only works with iOS6. Autolayout仅适用于iOS6。 This option can be found when looking at your view controller in the File Inspector Area under Interface Builder Document. 在Interface Builder Document下的File Inspector Area中查看视图控制器时,可以找到此选项。 It is a checkbox 这是一个复选框

Seems like you're not the only person with Simulator 5.1 issues in XCode 4.5. 好像你不是XCode 4.5中唯一有模拟器5.1问题的人。 Bug in iPhone Simulator 5.1 with Xcode 4.5 using UIManagedDocument My apps broke too. 使用UIManagedDocument的Xcode 4.5的iPhone模拟器5.1中的错误我的应用程序也破了。 5.0 sim seems to work well enough. 5.0 sim似乎运行得很好。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM