johnno1962 / injectionforxcode

Runtime Code Injection for Objective-C & Swift
MIT License
6.55k stars 565 forks source link

Do initialization in correct time #117

Closed wonderffee closed 8 years ago

wonderffee commented 8 years ago

Every time I launch Xcode, it alerts "InInjectionPlugin: Could not locate Product Menu". Then I found an asynchronous but unreliable initialization was used. Maybe my Mac Mini is too slow and ever time it triggers above problem. My solution is to do initialization when receiving notification of NSApplicationDidFinishLaunchingNotification.

johnno1962 commented 8 years ago

Thanks. This is the way it used to work. Let me have a look at another solution. using the Async call has the advantage that people don’t need to restart Xcode when they install the plugin.

johnno1962 commented 8 years ago

@wonderffee I’ve pushed a change to retry if the product menu is not available. Can you give it a try?

wonderffee commented 8 years ago

It does work! Nice job!👍