[ios] Xcode에서 iOS 시뮬레이터를 시작하고 검은 색 화면이 나타난 후 Xcode가 중단되고 작업을 중지 할 수 없음

iOS 시뮬레이터에서 기본 iPhone 응용 프로그램 (Stanford iTunes CS193p 강의를 진행하는 동안)을 실행하는 데 문제가 있습니다.

나는 잠시 (구글과 SO 모두) 검색했지만 지금까지 해결책을 찾을 수 없습니다. 유사한 버그가 많이 있지만 솔루션으로 해결되지 않는 것 같습니다.

Xcode에서 “실행”을 클릭합니다. 성공적으로 컴파일 및 빌드되고 iOS 시뮬레이터를 시작하지만 앱을로드하지 못합니다. 상단의 상태 표시 줄 만. 검은 화면으로.

나는 매우 기본적인 코드 (강의와 함께) 만 작성했고이 문제를 극복 할 수 없다.

문제를 더 혼동하기 위해 저는 (UIWebView)이 강의 전에 웹 래퍼 를 작성 했으며 이것은 잘 작동합니다. 그러나 코드에는 거의 차이가 없습니다. 처음부터 새로 만든 모든 앱이 모두 동일한 검은 색 화면 문제로 실패합니다.

시뮬레이터의 홈 버튼을 누르고 앱을 실행하면 표시됩니다. 그러나 Xcode는 무슨 일이 일어나고 있는지 알지 못하는 것 같습니다.

마치 Xcode가 iOS Simulator와 통신 할 수있는 기능을 잃어 버리고 실행 중이라고 가정합니다 (iOS 시뮬레이터를 종료하더라도). Xcode를 종료하려고하면 작업을 중지하라는 메시지가 표시됩니다. 그러면 그냥 멈 춥니 다. 그래서 Xcode에서 나오려면 강제로 재시작해야합니다.

나는 사용하고있다 : OSX 10.8.2 Xcode 4.5.2 iOS Simulator 6.0

CalculatorAppDelegate.h

#import <UIKit/UIKit.h>

@interface CalculatorAppDelegate : UIResponder <UIApplicationDelegate>

@property (strong, nonatomic) UIWindow *window;

@end

CalculatorAppDelegate.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에서는 하드웨어 아래)


답변

에뮬레이터를 재설정하기 전에 먼저 프로젝트 ” project navigator “화면으로 이동하여 일반 -> depoyment 정보 화면에서 기본 인터페이스 속성이 올바르게 설정되었는지 확인하십시오!

여기에 이미지 설명 입력


답변

SwiftUI를 사용하는 경우

이전 버전의 Xcode 11에서 업데이트하는 경우 SceneDelegate willConnectTo session: options connectionOptions초기화에 몇 가지 변경 사항이 있습니다.

메인 window은 이제를 사용하여 초기화 UIWindow(windowScene: windowScene)됩니다.UIWindow(frame: UIScreen.main.bounds)

이전 버전 :

    let window = UIWindow(frame: UIScreen.main.bounds)
    window.rootViewController = UIHostingController(rootView: ContentView())
    self.window = window
    window.makeKeyAndVisible()

새 버전 :

    if let windowScene = scene as? UIWindowScene {
        let window = UIWindow(windowScene: windowScene)
        window.rootViewController = UIHostingController(rootView: ContentView())
        self.window = window
        window.makeKeyAndVisible()
    }


답변

저는 iOS 앱 개발의 초보자입니다. 저는 처음부터 iOS 앱 개발을 연습하고 있었고 매우 기본적인 Hello World 앱을 실행하는 동안 iOS 시뮬레이터에서 앱을 빌드하고 실행 한 후 검은 색 빈 화면 만 나타나는 동일한 문제에 직면했습니다. 어떻게 든 문제에 대한 해결책을 찾기 위해 고군분투하는 동안 실수로 iOS 시뮬레이터에서 Window-> Scale-> 50 %를 클릭했는데 문제가 해결되었습니다. 그런 다음 내 앱이있는 홈 페이지를 볼 수 있었고 앱 아이콘을 클릭하여 앱을 성공적으로 실행할 수있었습니다. 앱 버전 : Xcode 5.1 iOS 시뮬레이터 : 7.1 OSX : 10.9.3


답변

이는 올바른 배포 정보를 설정하지 않았기 때문일 수 있습니다. (즉, 스토리 보드가 기본 인터페이스로 설정되지 않은 경우)


답변

컴퓨터를 다시 시작하면됩니다.


답변

해결 방법 1 :Quit simulator 다시 시도 할 수 있습니다 .

해결 방법 2 (권장) : 이동 iOS Simulator->Reset Content and Settings...

1 단계

그러면 다음과 같은 경고가 나타납니다. 'Are you sure you want to reset the iOS Simulator content and settings?'

2 단계

원하는 Reset경우 선택 하거나 다른 Don't Reset버튼을 클릭합니다.

시뮬레이터 콘텐츠를 재설정하면 시뮬레이터에 설치된 모든 앱이 삭제되고 초기 설정으로 재설정됩니다.