我想知道如何在 XCode 中为 MovieEditorViewController 头文件添加 @synthesize 语句
实现文件如下所示:
#import "MovieViewController.h"
#import "Movie.h"
#import "MovieEditorViewController.h"
@implementation MovieViewController
@synthesize titleLabel;
@synthesize boxOfficeGrossLabel;
@synthesize summaryLabel;
@synthesize movie;
但我认为我的问题不是为 MovieEditorViewController 头文件添加 @synthesize 语句。如果不是这个,那么我已经在下面包含了调试日志。
我对编程真的很陌生,我似乎真的不知道出了什么问题。当我运行 iOS 模拟器并单击按钮显示可编辑文本字段时,程序终止并返回主屏幕。调试器显示如下:
[会议开始于2011-06-04 13:00:00 +0100.]2011-06-04 13:00:05.568 电影[6678:207] -[MovieViewController编辑视图控制器]:无法识别 选择器发送到实例 0x8a3bd10 2011-06-04 13:00:05.572 电影[6678:207] * 终止应用程序 由于未捕获的异常 'NSInvalidArgumentException',原因: '-[MovieViewController editViewController]:无法识别 选择器发送到实例 0x8a3bd10' * 第一次抛出时调用堆栈:( 0 CoreFoundation
0x00dc95a9 异常预处理 + 185 1 libobjc.A.dylib
0x00f1d313 objc_异常_抛出 + 44 2 核心基础
0x00dcb0bb -[NSObject(NSObject) 不识别选择器:] + 187 3
核心基础
0x00d3a966 __转发 + 966 4
核心基础
0x00d3a522 _CF_forwarding_prep_0 + 50 5 电影
0x000021b4 -[MovieViewController 编辑] + 62 6 UIKit 0x002b94fd -[UIApplication 发送操作:至:来自:forEvent:] + 119 7 UIKit
0x00349799-[UI控制 sendAction:to:forEvent:] + 67 8
UIKit
0x0034bc2b -[UIControl(内部) _sendActionsForEvents:withEvent:] + 527 9 UIKit
0x0034a7d8-[UI控制 触摸结束:withEvent:] + 458 10 UIKit
0x002ddded-[UIWindow _sendTouchesForEvent:] + 567 11 UIKit
0x002bec37 -[UIApplication 发送事件:] + 447 12 UIKit 0x002c3f2e _UIApplicationHandleEvent + 7576 13 图形服务
0x01721992 紫色事件回调 + 1550 14 核心基础
0x00daa944 CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE1_PERFORM_FUNCTION + 52 15 核心基础 0x00d0acf7 __CFRunLoopDoSource1 + 215 16 核心基础
0x00d07f83 __CFRunLoopRun + 979 17 核心基础
0x00d07840 CFRunLoopRunSpecific + 208 18 核心基础
0x00d07761 CFRunLoopRunIn模式 + 97 19 图形服务
0x017201c4 GSEventRunModal + 217 20 图形服务
0x01720289 GSEventRun + 115 21 UIKit 0x002c7c93 UIApplicationMain + 1160 22 电影
0x00001b40 主 + 102 23 电影
0x00001ad1 开始 + 53 24 ???
0x00000001 0x0 + 1 ) 终止调用 抛出一个实例后 'NSException'
如果有人能指出我正确的方向,我将非常感激......
谢谢!
The implementation file looks like this:
#import "MovieViewController.h"
#import "Movie.h"
#import "MovieEditorViewController.h"
@implementation MovieViewController
@synthesize titleLabel;
@synthesize boxOfficeGrossLabel;
@synthesize summaryLabel;
@synthesize movie;
but i'm thinking my problem is not adding @synthesize statements for the MovieEditorViewController header file. If it's not this then I've included the debugging log below.
I'm really new to programming and I really can't seem to figure out whats going wrong. When I run the iOS simulator and click the button to display editable text fields the program terminates and goes back to the homescreen. The debugger shows as follows:
[Session started at 2011-06-04
13:00:00 +0100.] 2011-06-04
13:00:05.568 Movie[6678:207]
-[MovieViewController editingViewController]: unrecognized
selector sent to instance 0x8a3bd10
2011-06-04 13:00:05.572
Movie[6678:207] * Terminating app
due to uncaught exception
'NSInvalidArgumentException', reason:
'-[MovieViewController
editingViewController]: unrecognized
selector sent to instance 0x8a3bd10'
* Call stack at first throw: ( 0 CoreFoundation
0x00dc95a9 exceptionPreprocess + 185
1 libobjc.A.dylib
0x00f1d313 objc_exception_throw + 44
2 CoreFoundation
0x00dcb0bb -[NSObject(NSObject)
doesNotRecognizeSelector:] + 187 3
CoreFoundation
0x00d3a966 __forwarding + 966 4
CoreFoundation
0x00d3a522 _CF_forwarding_prep_0 + 50
5 Movie
0x000021b4 -[MovieViewController edit]
+ 62 6 UIKit 0x002b94fd -[UIApplication
sendAction:to:from:forEvent:] + 119 7
UIKit
0x00349799 -[UIControl
sendAction:to:forEvent:] + 67 8
UIKit
0x0034bc2b -[UIControl(Internal)
_sendActionsForEvents:withEvent:] + 527 9 UIKit
0x0034a7d8 -[UIControl
touchesEnded:withEvent:] + 458 10
UIKit
0x002ddded -[UIWindow
_sendTouchesForEvent:] + 567 11 UIKit
0x002bec37 -[UIApplication sendEvent:]
+ 447 12 UIKit 0x002c3f2e _UIApplicationHandleEvent +
7576 13 GraphicsServices
0x01721992 PurpleEventCallback + 1550
14 CoreFoundation
0x00daa944
CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE1_PERFORM_FUNCTION
+ 52 15 CoreFoundation 0x00d0acf7 __CFRunLoopDoSource1 + 215
16 CoreFoundation
0x00d07f83 __CFRunLoopRun + 979 17
CoreFoundation
0x00d07840 CFRunLoopRunSpecific + 208
18 CoreFoundation
0x00d07761 CFRunLoopRunInMode + 97 19
GraphicsServices
0x017201c4 GSEventRunModal + 217 20
GraphicsServices
0x01720289 GSEventRun + 115 21 UIKit
0x002c7c93 UIApplicationMain + 1160
22 Movie
0x00001b40 main + 102 23 Movie
0x00001ad1 start + 53 24 ???
0x00000001 0x0 + 1 ) terminate called
after throwing an instance of
'NSException'
If anyone could point me in the right direction i'd be very grateful...
Thanks!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
看来您正处于 iPhone SDK 开发书。您已经完成第 4.8 节了吗?该错误表明您的
MovieViewController
没有名为editingViewController
的属性,这是您在 4.8 中添加的属性。在您完成第 4.9 节之前,该项目不会构建并运行,您可以在第 4.9 节中建立一些联系。Looks like you're in the iPhone SDK Development book. Have you made it to section 4.8 yet? The error says that your
MovieViewController
doesn't have a property namededitingViewController
, which is something you add in 4.8. The project won't build and run until you get through section 4.9, which is where you make some connections.