I hope someone will be able to help me since this issue is killing my productivity.. One week on this even if I am quite new to Mac development.
I have a Carbon application in which I want to add a feature: Get the path of a file I double clicked in the finder.
I have
- modified the project to allow Objective C calls.
- setup a delegate object and assigned it to NSApp
- implemented 开发者_运维技巧
- (BOOL)application:(NSApplication *)app openFile:(NSString *)filename
in the delegate.
the problem: the delegate method is NOT hit when double click a file in the finder.
I am sure I am missing something (memory/scope issue ? Event loop issue (using RunApplicationEventLoop for now)
If somebody has an hint I would be pleased to hear it.
Thank you all.
In a Carbon application, NSApp will be nil. NSApp is defined during the NSApplicationMain function, which is called to start a Cocoa application. In a Carbon application, you need to use Carbon methods to determine when an application is being opened. Install an event handler and listen for the 'odoc' apple event.
精彩评论