【发布时间】:2010-09-10 16:17:54
【问题描述】:
这对我来说毫无意义。也许这里有人可以解释为什么会发生这种情况。
我有一个 NSMutableString,我分配在我的 iPhone 应用程序的顶部,然后在该过程的稍后部分附加。它会导致一个 SIGABRT,这对我来说并不重要。代码如下:
头文件(简体):
@interface MyAppDelegate : NSObject <UIApplicationDelegate> {
UIWindow *window;
NSMutableString *locationErrorMessage;
}
@property (nonatomic, retain) IBOutlet UIWindow *window;
@property (nonatomic, copy) NSMutableString *locationErrorMessage;
@end
以及Main的相关部分:
@implementation MyAppDelegate
@synthesize window;
@synthesize locationErrorMessage;
- (void)applicationDidFinishLaunching:(UIApplication *)application {
self.locationErrorMessage = [[NSMutableString alloc] init];
}
- (void)anotherFunction {
[self.locationErrorMessage appendString: @"Blah Blah Blah"];
}
这一切看起来都很简单。我错过了什么?
【问题讨论】:
-
肯定还有一些其他相关的代码你没有显示...也许发布崩溃日志,它可能会有所帮助
标签: iphone objective-c nsmutablestring