【问题标题】:Xcode iPhone app runs and crashes immediatelyXcode iPhone 应用程序立即运行并崩溃
【发布时间】:2015-07-12 08:09:32
【问题描述】:

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>

【问题讨论】:

  • 是的,您显然做错了某事。你能提供一些代码吗?
  • 没什么可放的。我的意思是我只是在视图上贴了一个标签(在 xib 中)。
  • 什么是控制台日志(使用 cmd+SHIFT+c 启动 degugger colsole)?
  • @RahulSharma 我在程序开始和结束后使用了这个热键,但它仍然是空的

标签: ios crash


【解决方案1】:

您的项目太小,甚至无法尝试使用 armour 中的所有调试工具。如果我是你,我会从以下步骤开始,以消除根本原因并调查问题。

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

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

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

【讨论】:

    猜你喜欢
    • 2019-03-29
    • 1970-01-01
    • 2012-07-04
    • 2023-03-08
    • 2020-01-25
    • 2013-07-07
    • 2020-01-25
    • 2012-07-27
    • 1970-01-01
    相关资源
    最近更新 更多