Xcode iPhone 应用立即运行并崩溃

Xcode iPhone app runs and crashes immediately

Xcode(最新)。当运行应用程序时,它会立即关闭。该应用程序在模拟器上加载,因此图片出现,但屏幕变白,因此该应用程序堆叠。只有唯一的标签和绿色背景。

这是刚开始时的样子:http://tinypic.com/r/2dvu7io/8

第二个:http://tinypic.com/r/98wp5u/8

#import "ViewController.h"

@interface ViewController ()

@end

@implementation ViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    // Do any additional setup after loading the view, typically from a nib.
}

- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

@end
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<document type="com.apple.InterfaceBuilder3.CocoaTouch.XIB" version="3.0" toolsVersion="7702" systemVersion="14D136" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" launchScreen="YES" useTraitCollections="YES">
    <dependencies>
        <plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="7701"/>
    </dependencies>
    <objects>
        <placeholder placeholderIdentifier="IBFilesOwner" id="-1" userLabel="File's Owner"/>
        <placeholder placeholderIdentifier="IBFirstResponder" id="-2" customClass="UIResponder"/>
        <view contentMode="scaleToFill" id="iN0-l3-epB">
            <rect key="frame" x="0.0" y="0.0" width="375" height="667"/>
            <autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
            <subviews>
                <label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" fixedFrame="YES" text="Hello World!" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="BkG-X7-MYE">
                    <rect key="frame" x="115" y="289" width="133" height="41"/>
                    <fontDescription key="fontDescription" type="system" pointSize="25"/>
                    <color key="textColor" cocoaTouchSystemColor="darkTextColor"/>
                    <nil key="highlightedColor"/>
                </label>
                <label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" fixedFrame="YES" text="Label" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="I9t-Ne-eCZ">
                    <rect key="frame" x="146" y="216" width="42" height="21"/>
                    <fontDescription key="fontDescription" type="system" pointSize="17"/>
                    <color key="textColor" cocoaTouchSystemColor="darkTextColor"/>
                    <nil key="highlightedColor"/>
                </label>
            </subviews>
            <color key="backgroundColor" red="0.82914447010375036" green="1" blue="0.67541074406557622" alpha="0.70999999999999996" colorSpace="calibratedRGB"/>
            <nil key="simulatedStatusBarMetrics"/>
            <simulatedScreenMetrics key="simulatedDestinationMetrics" type="retina47"/>
            <point key="canvasLocation" x="517.5" y="438.5"/>
        </view>
    </objects>
</document>

你的项目太小了,连盔甲中的所有调试工具都试过了。如果我是你,我会从以下这些步骤开始,以消除根本原因并调查问题。

a) 尝试使用与当前项目相同的步骤创建一个新的示例项目,然后尝试 运行。如果一切顺利,可能是 XCode 中的某些插件出了问题,这可能导致文件损坏。 b) 如果问题仍然存在,请尝试在各种方法上使用断点,即

- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
- (void)viewDidLoad
- (void)viewWillAppear:(BOOL)animated
- (void)viewDidAppear:(BOOL)animated

很可能这些步骤应该揭示在到达停滞屏幕之前您到达了哪个阶段。