从 Xcode 启动 iOS 模拟器并出现黑屏,然后 Xcode 挂起且无法停止任务

2023-11-30

我在 iOS 模拟器中运行基本 iPhone 应用程序时遇到问题(在阅读斯坦福 iTunes CS193p 讲座时)。

我已经搜索了一段时间(Google 和 SO),但到目前为止找不到解决方案。类似的错误还有很多,但解决方案似乎并不能解决这个问题。

在 Xcode 中,我单击“运行”。它编译并构建成功,启动 iOS 模拟器,但从未加载应用程序。只有顶部的状态栏。黑屏。

我只编写了非常基本的代码(跟随讲座)并且无法解决这个问题。

为了让事情更加混乱,我写了一个网络包装器(UIWebView)在这些讲座之前,这效果很好。但代码上几乎没有任何区别。我从头开始创建的所有新应用程序都因相同的黑屏问题而失败。

如果我点击模拟器上的主页按钮并启动应用程序,它将显示。但 Xcode 似乎不知道发生了什么。

就好像 Xcode 失去了与 iOS 模拟器对话的能力并假设它正在运行(即使我退出了 iOS 模拟器)。我尝试退出 Xcode,它要求我停止任务。然后它就挂了。所以我必须强制重新启动才能退出 Xcode。

我在用着: 操作系统 10.8.2 Xcode 4.5.2 iOS模拟器6.0

计算器 AppDelegate.h

#import <UIKit/UIKit.h>

@interface CalculatorAppDelegate : UIResponder <UIApplicationDelegate>

@property (strong, nonatomic) UIWindow *window;

@end

计算器 AppDelegate.m

#import "CalculatorAppDelegate.h"

@implementation CalculatorAppDelegate

- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions (NSDictionary *)launchOptions
{
    // Override point for customization after application launch.
    return YES;
}

- (void)applicationWillResignActive:(UIApplication *)application
{
// Sent when the application is about to move from active to inactive state. This can occur for certain types of temporary interruptions (such as an incoming phone call or SMS message) or when the user quits the application and it begins the transition to the background state.
// Use this method to pause ongoing tasks, disable timers, and throttle down OpenGL ES frame rates. Games should use this method to pause the game.
}

- (void)applicationDidEnterBackground:(UIApplication *)application
{
// Use this method to release shared resources, save user data, invalidate timers, and store enough application state information to restore your application to its current state in case it is terminated later. 
// If your application supports background execution, this method is called instead of applicationWillTerminate: when the user quits.
}

- (void)applicationWillEnterForeground:(UIApplication *)application
{
// Called as part of the transition from the background to the active state; here you can undo many of the changes made on entering the background.
}

- (void)applicationDidBecomeActive:(UIApplication *)application
{
// Restart any tasks that were paused (or not yet started) while the application was inactive. If the application was previously in the background, optionally refresh the user interface.
}

- (void)applicationWillTerminate:(UIApplication *)application
{
// Called when the application is about to terminate. Save data if appropriate. See also applicationDidEnterBackground:.
}

@end

CalculatorViewController.h

#import <UIKit/UIKit.h>

@interface CalculatorViewController : UIViewController
@property (weak, nonatomic) IBOutlet UILabel *display;

@end

CalculatorViewController.m

#import "CalculatorViewController.h"

@implementation CalculatorViewController

@synthesize display = _display;

- (IBAction)digitPressed:(UIButton *)sender
{
    NSString *digit = [sender currentTitle];
NSLog(@"digit pressed = %@", digit);
}

@end

令人惊讶的是,对我有用的是进入 iOS 模拟器菜单,然后按“重置内容和设置”。 (在 iOS 13 中,位于硬件下)

本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)

从 Xcode 启动 iOS 模拟器并出现黑屏,然后 Xcode 挂起且无法停止任务 的相关文章

随机推荐

  • BlackBerry - 如何在 Android 中传递 Intent.putExtra() 等数据

    我是黑莓手机的新手 我如何实现 在黑莓手机中 与 Android 相同的功能 intent putExtra key value 将可以接收到的值放在下一个推屏在黑莓手机中 就像在 Android 中一样ActivityOne Intent
  • 有没有办法访问iphone/ipad(真机,无模拟器)中的文档文件夹?

    有没有办法访问真实设备 iphone ipad 文档文件夹 我意识到一个应用程序在该文件夹中存储了一些数据 我想检查一切是否都以正确的方式进行 即使文件位于沙盒中文档之外的其他位置 您也可以在没有 iTunes 的情况下执行此操作 转到 X
  • “出于安全原因,proc_open() 已被禁用”- PHP 错误

    出于安全原因 proc open 已被禁用 我目前使用免费托管 Hostinger 制作一个仅供我和其他人使用的个人网站 我知道我应该删除proc open来自php ini但由于我的共享托管计划 我无法访问它 周围的代码proc open
  • 为什么 Inno Setup 忽略 DefaultDirName

    运行 Inno Setup 5 5 6 我更正了我的错误默认目录名值 但无论我做什么 程序都会继续尝试安装在旧的错误位置 即使我将其设置为与示例之一匹配的值 DefaultDirName pf My Program 程序继续选择旧的 不正确
  • 当我编译这段代码时发生错误C6308,说realloc可以返回NULL,并且可能导致内存泄漏

    void inf int Sub const char num const unsigned int index if this gt length lt index this gt digits char realloc this gt
  • 结构体变量初始化

    我尝试按如下方式初始化结构变量 struct Abc char str 10 int main struct Abc s1 s1 str Hello error 我可以理解这种行为 因为它与 char str 10 str Hello in
  • 使用Java API将数据上传到HDFS

    我已经搜索了一段时间 但似乎没有一个解决方案适合我 非常简单 我想使用 Java API 将数据从本地文件系统上传到 HDFS Java 程序将在已配置为通过 shell 与远程 Hadoop 集群通信的主机上运行 即hdfs dfs ls
  • ggplot2:如何动态包装/调整大小/重新缩放 x 轴标签,使其不会重叠

    我正在尝试实现一种包装 x 轴标签的解决方案 以便它们不会重叠 我知道这个问题已经被问过好几次了 并且有一些好的答案 但是 我见过的解决方案都没有回答如何随着情节的发展重新包装标签resized SO 的三个不同答案让我相信这是可以实现的
  • Mac 上的 SWT 问题

    我有一个使用 SWT UI 的 java 项目 但在任何 Mac OS X 计算机上部署它时遇到了问题 当程序从 Eclipse 中或从 jar 文件运行时 它本身可以在 Windows 上完美运行 在 Mac 上 该程序在 Eclipse
  • MongoDB:是否可以进行不区分大小写的查询?

    Example gt db stuff save foo bar gt db stuff find foo bar count 1 gt db stuff find foo BAR count 0 你可以使用regex 在你的例子中 这将是
  • 从linux命令行创建word doc文件

    我有一些 HTML 文件需要以 MS Word 文档格式分发 不要问 我可以在 OpenOffice 中手动打开每个文件 然后另存为 doc 文件 但我有很多文件 所以我想自动执行此操作 你知道一个方法吗 没有测试过 但是有pyuno访问
  • 将大小写切换到/之间

    Javascript 有没有一种方法可以通过 switch case 结构将一个整数与另一个整数进行比较 而不使用 if 语句 E g switch integer case 1 to 10 break case 11 to 20 brea
  • Mpi 在 Windows 中的使用

    我将 mpi 安装到 Windows 中 并且可以使用它的库 问题是 当我在 Windows 中编写时 mpiexec n 4 proj exe 进入命令提示符后 它不会进行正确的操作 4个不同的进程分别使用整个代码文件 它们的行为不像仅在
  • C# 并行运行多个非阻塞外部程序

    我需要从我的应用程序运行外部可执行文件的多个实例 该可执行文件的平均运行时间约为 3 分钟 我想重定向这些进程的输出 并更新 GUI 中的进度条 当然 我不想等到他们回来才能继续使用我的应用程序 我认为我应该为每个实例创建一个线程 并在线程
  • Ms Access 多选列表框移动器

    我有两个列表框 lfmVocabulary 和 lfmVocabularyAssign 它们都与表单没有绑定 我在实现代码设计的某些方面遇到了困难 到目前为止 我可以通过查询记录集使用值填充第一个列表表单 但我无法将项目从一个框传输到另一个
  • 无法解析 javax.xml.stream.XMLStreamReader 类型

    无法解析 javax xml stream XMLStreamReader 类型 它是从所需的 class 文件间接引用的 我在一行中收到此错误 我缺少哪个 jar javax xml stream XMLStreamReader在 Jav
  • 在 SQL Server XML 处理中参数化 XPath 以便修改()

    正如标题所示 我尝试参数化 SQL Server 中 XML 数据列的 edit 方法的 XPath 但遇到了一些问题 到目前为止我有 DECLARE newVal varchar 50 DECLARE xmlQuery varchar 5
  • 将外部js注入到自己创建的iframe中

    所以我试图将外部 css 和 js 注入到自己创建的 iframe 中以提供额外的安全层 因此不存在跨域问题 这是代码
  • 如何使用 POP3 检索 Gmail 子文件夹/标签?

    下面的代码使用javamail API来访问gmail String host pop gmail com int port 995 Properties properties new Properties properties put m
  • 从 Xcode 启动 iOS 模拟器并出现黑屏,然后 Xcode 挂起且无法停止任务

    我在 iOS 模拟器中运行基本 iPhone 应用程序时遇到问题 在阅读斯坦福 iTunes CS193p 讲座时 我已经搜索了一段时间 Google 和 SO 但到目前为止找不到解决方案 类似的错误还有很多 但解决方案似乎并不能解决这个问