0

私はこれに似た他の質問を見ましたが、どの解決策も使用できませんでした。

.h

@property (assign) IBOutlet NSTextView *commandOutput;

.m

- (void)applicationDidFinishLaunching:(NSNotification *)aNotification
{
    Command *aCommand = [[Command alloc] init];
    [self setCommand:aCommand];

    if (self.commandOutput) NSLog(@"textView is not nil");
    [self.commandOutput setString:@""];
}

私が受け取るエラーメッセージは次のとおりです。-[NSScrollView setString:]: unrecognized selector sent to instance 0x100608630

私もそれを見ます:textView is not nil

4

1 に答える 1

2

エラーメッセージから私が疑うのは、commandOutputアウトレットを内の内側にNSScrollViewバインドしたことですNSTextView。このログトレースを使用すると、実際のタイプに関する詳細情報を入手できますself.commandOutput

if (self.commandOutput) NSLog(@"textView is not nil: %@", [self.commandOutput description]);

したがって、私の提案は、Interface Builderでバインディングをチェックし、アウトレットを誤って間違ったビューにドラッグしていないことを確認することです。

于 2012-11-16T15:25:54.280 に答える