【问题标题】:Crashing Math App崩溃的数学应用程序
【发布时间】:2011-01-25 01:11:19
【问题描述】:

我正在制作一个简单的数学加法应用程序,Xcode 说它可以正确构建,但该应用程序无法在模拟器或我的设备上打开。这是一个基于 winow 的应用程序,但我手动添加了 UITabBarController

这就是我的 AreaViewController.h 所说的

#import <UIKit/UIKit.h>


@interface AreaViewController : UIViewController {
  <snipped ivars>
}

@property (retain, nonatomic) UITextField *add11;
@property (retain, nonatomic) UITextField *add12;
@property (retain, nonatomic) UITextField *add13;
@property (retain, nonatomic) UITextField *add21;
@property (retain, nonatomic) UITextField *add22;
@property (retain, nonatomic) UITextField *add23;
@property (retain, nonatomic) UITextField *add31;
@property (retain, nonatomic) UITextField *add32;
@property (retain, nonatomic) UITextField *add33;
@property (retain, nonatomic) UILabel *add1Result;
@property (retain, nonatomic) UILabel *add2Result;
@property (retain, nonatomic) UILabel *add3Result;

-(IBAction)calculate:(id)sender;
-(IBAction)hideKeyboard:(id)sender;

@end

我的 AreaViewController.m

#import "AreaViewController.h"


@implementation AreaViewController

@synthesize add11, add12, add13;
@synthesize add21, add22, add23;
@synthesize add31, add32, add33;
@synthesize add1Result, add2Result, add3Result;

-(IBAction)calculate:(id)sender {
 float floatAdd1Result=[add11.text floatValue]+[add12.text floatValue]+[add13.text floatValue];
 float floatAdd2Result=[add21.text floatValue]+[add22.text floatValue]+[add23.text floatValue];
 float floatAdd3Result=[add31.text floatValue]+[add32.text floatValue]+[add33.text floatValue];

 add1Result.text=[NSString stringWithFormat:@"%1.2f",floatAdd1Result];
 add2Result.text=[NSString stringWithFormat:@"%1.2f",floatAdd2Result];
 add3Result.text=[NSString stringWithFormat:@"%1.2f",floatAdd3Result];
}

-(IBAction)hideKeyboard:(id)sender {
 [add11 resignFirstResponder];
 [add12 resignFirstResponder];
 [add13 resignFirstResponder];
 [add21 resignFirstResponder];
 [add22 resignFirstResponder];
 [add23 resignFirstResponder];
 [add31 resignFirstResponder];
 [add32 resignFirstResponder];
 [add33 resignFirstResponder];
}    

- (void)dealloc {
 [add11 release];
 [add12 release];
 [add13 release];
 [add21 release];
 [add22 release];
 [add23 release];
 [add31 release];
 [add32 release];
 [add33 release];
 [add1Result release];
 [add2Result release];
 [add2Result release];
 [super dealloc];
}


@end

我的控制台说:

[Session started at 2011-01-24 18:33:13 -0600.]

WARNING: Falling back to active SDK directory at: /Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS4.0.sdk

<snip>
This GDB was configured as "--host=i386-apple-darwin --target=arm-apple-darwin".tty /dev/ttys004
Loading program into debugger…
Program loaded.
target remote-mobile /tmp/.XcodeGDBRemote-3466-67
Switching to remote-macosx protocol
mem 0x1000 0x3fffffff cache
mem 0x40000000 0xffffffff none
mem 0x00000000 0x0fff none
run
Running…
[Switching to thread 11523]
[Switching to thread 11523]
sharedlibrary apply-load-rules all
continue
warning: UUID mismatch detected with the loaded library - on disk is:
 /Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS4.0.sdk/System/Library/Frameworks/Foundation.framework/Foundation
<snip>
warning: UUID mismatch detected with the loaded library - on disk is:
 /Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS4.0.sdk/System/Library/PrivateFrameworks/MBX2D.framework/MBX2D
Ignoring packet error, continuing...
gdb stack trace around reply contains invalid hex digit:
0   gdb-arm-apple-darwin                0x0018dc33 remote_backtrace_self + 54�
1   gdb-arm-apple-darwin                0x0019081d fromhex + 65�
<snip>
43  gdb-arm-apple-darwin                0x00085592 catch_errors + 78�
44  gdb-arm-apple-darwin                0x0008646b gdb_main + 63�
45  gdb-arm-apple-darwin                0x00001f06 main + 52�
46  gdb-arm-apple-darwin                0x00001e95 start + 53�
recent remote packet log at point of error:
Sent:  [1295915610.545:96] m3757d780,40
Recvd: [1295915610.548:96] 1800000074f9710fa01a33b5bb04c4aeabd6be7d220000803000000000000000000000000c3197080807000000e06c080000000064eaa708c8120000cc688b08
Sent:  [1295915610.548:96] m3757d7c0,40
Recvd: [1295915610.551:96] 

warning: Unable to read symbols from [memory object "/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS4.0.sdk/System/Library/PrivateFrameworks/MBX2D.framework/MBX2D" at 0x3076a000]: File format not recognized.
warning: Could not read dyld entry: /Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS4.0.sdk/System/Library/PrivateFrameworks/MBX2D.framework/MBX2D from inferior memory at 0x3076a000 with slide 0x0 and length 4294967295.

The Debugger has exited due to signal 15 (SIGTERM).The Debugger has exited due to signal 15 (SIGTERM).

[Session started at 2011-01-24 18:36:46 -0600.]
Terminating in response to SpringBoard's termination.

Dave DeLong 编辑:

我已经尽可能地精简了代码。我删除了实例变量声明并留下了 @property 语句,折叠了 @synthesize 行,简化了代码,剥离了死方法,剪掉了长重复的东西等。我还删除了代码下载链接,因为它只链接到.xcodeproj 文件的压缩副本(但没有源)。

【问题讨论】:

  • @user588343 StackOverflow 不是一个你可以转储一堆代码并要求我们为你解决问题的地方。您需要向我们展示您试图将其缩小到特定的方法,并向我们展示您为解决问题所做的工作。

标签: iphone ios4


【解决方案1】:

您在动态加载程序中死去的事实似乎意味着您的二进制文件没有正确构建。当我开始遇到奇怪的错误时,我发现最好清理我的整个项目并从头开始重新构建所有内容。要清理,只需进入 Build 菜单并选择“Clean All Targets”。完成后,再次尝试构建和运行。

【讨论】:

  • 抱歉把所有的代码都扔掉了。我对开发有点陌生。好的,我尝试清理我的整个项目并再次在模拟器中重建它,但它仍然有同样的问题。我尝试从头开始重新编写代码,但仍然没有。我想知道您是否有机会查看我的源文件。您可以尝试做些什么来使其正常工作。我的源文件的链接在上面。任何帮助,将不胜感激!!!我正在尝试为应用商店制作我的第一个应用。提前致谢!
  • @user588343 您最初发布的链接仅适用于 xcodeproj 文件,其中仅包含项目中文件的列表。它实际上并不包含源代码。
  • 我应该实际发布什么?整个应用程序文件夹??如果这是您需要的,那没问题
  • @user588343 整个项目文件夹(但请先删除“build”文件夹)是编译所必需的。但是,您是否尝试过清理和重建?
  • @DaveDeLong 抱歉,这是没有构建文件夹的更新版本。这是链接:hotfile.com/dl/99515977/80ea468/SuperCalculator_copy_2.zip.html
【解决方案2】:

试试:

  1. 拔掉手机
  2. 从手机中删除应用程序(使用将手指放在图标上直到出现“X”的标准方法)
  3. 删除后,重新插入并重新构建
  4. 应用再次在设备上崩溃,但这次崩溃后,再次拔下电源并直接从手机运行

【讨论】:

  • 我刚试过这个,但仍然是同样的问题。该应用程序打开状态栏后出现黑屏,但它只是卡在那里。
  • 你可以尝试创建一个新的标签栏控制器项目,看看这个干净的项目是否可以运行,然后分阶段移动你的源代码并编译看看它是否可以运行,干杯。
【解决方案3】:

有时这对我有帮助:

  1. 重启您的设备
  2. 重启 Xcode
  3. 清理所有构建并清理 xcode 缓存
  4. delete all breakpoints... 我看到 Xcode 在从项目中删除所有断点后再次变得疯狂和正常。有时 Xcode 会失去它的弹珠,你必须帮助它。
  5. 作为一个激进的措施,右键单击 xcodeproj 文件,选择 Show Package Contents 并删除该包中除 pbxproj 文件之外的所有内容。然后重新打开项目。

在执行 #5 之前备份您的项目...以防万一。

编辑:

您的磁盘或 Xcode 可能有问题。使用磁盘工具并验证/修复磁盘上的权限,从新版本中删除然后重新安装 Xcode / SDk。看看这是否有效。

【讨论】:

  • 刚试过这个...没有结果。我得到了与上面所说的相同的结果。天哪,我不知道我哪里错了。一切看起来都不错。你们中的一个人可以尝试用我的源代码构建这个应用程序,还是可以再尝试一次?它是一个带有标签栏控制器的基于窗口的应用程序。感谢大家的帮助!
  • 我在答案中添加了一个额外的项目。
猜你喜欢
  • 1970-01-01
  • 1970-01-01
  • 2011-03-31
  • 1970-01-01
  • 2014-08-05
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2012-12-11
相关资源
最近更新 更多