我在應用程序(它是在2011年編寫的)中有以下代碼。沒有已知的實例方法選擇器'myWindowController'
[[[[NSApp delegate] myWindowController] ...] ..];
由於升級到的Xcode 6.1這將產生以下的錯誤: - ARC Semantic Issue No known instance method for selector 'myWindowController'
通過以下更換此不產生錯誤。
id ttt = [NSApp delegate];
[[[ttt myWindowController] ...] ...];
PS Xcode中似乎認爲類型是 '身份證< NSFileManagerDelegate>'
這到底是怎麼回事?
我承認Cocoa和Xcode很生鏽。我相信我可以通過適當的演員來解決它,但這似乎沒有必要,我試圖理解爲什麼。
更多信息
我AppDelegate.h
IBOutlet MyWindowController *myWindowController;
而且AppDelegate.m
@synthesize myWindowController;
- (void)applicationDidFinishLaunching:(NSNotification *)aNotification {
myWindowController = [[MyWindowController alloc] initWithWindowNibName:@"MainWindow"];