seanhenry / SwiftMockGeneratorForXcode

An Xcode extension (plugin) to generate Swift test doubles automatically.
MIT License
748 stars 47 forks source link

Doesn't work with Xcode 10.2 #22

Closed dandreikiv closed 5 years ago

dandreikiv commented 5 years ago

I have followed instruction step by step, but in the end I couldn't see Mock Generator in the Editor menu. Could be the problem is with Xcode 10.2 only. With Xcode 10.1 everything worked fine.

dandreikiv commented 5 years ago

The issue can be closed. My mistake. I didn't follow steps precisely.

dandreikiv commented 5 years ago

Actually it started work in Xcode 10.2 only when I got Xcode 10.1 and reinstalled Swift Mock Generator. Without Xcode 10.1 it doesn't work in Xcode 10.2. When I remove Xcode 10.1 the Swift Mock Generator become inactive, it still present in Editor menu but greyed out.

seanhenry commented 5 years ago

Hi @dandreikiv

Thanks for raising these issues.

I'm not sure why it would only work if Xcode 10.1 is installed. I can't see any changes to Source Editor Extensions in Xcode 10.2.

I know a couple reasons why it could be greyed out:

If neither of those helps you I would try the usual restart of your machine to see if it fixes some weird state of the Xcode app. Or, perhaps try deselecting and selecting the extension in System Prefs -> Extensions and restarting.

Do you use any other extensions? It would be interesting if the problem is isolated to this one.

Also, when you said

I didn't follow steps precisely

Do you know which step you missed which fixed the issue?

dandreikiv commented 5 years ago

Hi @seanhenry, Thank you for the quick answer.

The source editor was open on Swift source file. And Xcode didn't index anything.

I have also found some errors in Console during launching Xcode 10.2

default 08:49:59.436883 +0100   pkd plugin /Applications/Swift Mock Generator for Xcode.app/Contents/PlugIns/Mock Generator.appex is still valid.
default 08:49:59.488157 +0100   pkd plugin /Applications/Swift Mock Generator for Xcode.app/Contents/PlugIns/Mock Generator.appex is still valid.
default 08:49:59.513304 +0100   secinitd    Mock Generator[2948]: root path for bundle "<private>" of main executable "<private>"
default 08:49:59.524406 +0100   secinitd    Mock Generator[2948]: AppSandbox request successful
error   08:49:59.529246 +0100   Mock Generator  Failed to find extension point <private> in the binding map, scanning all extension points
error   08:49:59.529269 +0100   Mock Generator  Failed to find extension point data for <private>
default 08:49:59.529311 +0100   Mock Generator  plug-in sdk "com.apple.dt.Xcode.extension.source-editor" not registered
error   08:49:59.530006 +0100   Mock Generator  Failed to find extension point <private> in the binding map, scanning all extension points
error   08:49:59.530025 +0100   Mock Generator  Failed to find extension point data for <private>
default 08:49:59.530055 +0100   Mock Generator  plug-in sdk "com.apple.dt.Xcode.extension.source-editor" not registered
error   08:49:59.530796 +0100   Mock Generator  Failed to find extension point <private> in the binding map, scanning all extension points
error   08:49:59.530817 +0100   Mock Generator  Failed to find extension point data for <private>
default 08:49:59.530855 +0100   Mock Generator  plug-in sdk "com.apple.dt.Xcode.extension.source-editor" not registered
default 08:57:56.194962 +0100   pkd plugin /Applications/Swift Mock Generator for Xcode.app/Contents/PlugIns/Mock Generator.appex is still valid.
default 08:49:59.436883 +0100   pkd plugin /Applications/Swift Mock Generator for Xcode.app/Contents/PlugIns/Mock Generator.appex is still valid.
default 08:49:59.488157 +0100   pkd plugin /Applications/Swift Mock Generator for Xcode.app/Contents/PlugIns/Mock Generator.appex is still valid.
default 08:49:59.513304 +0100   secinitd    Mock Generator[2948]: root path for bundle "<private>" of main executable "<private>"
default 08:49:59.524406 +0100   secinitd    Mock Generator[2948]: AppSandbox request successful
error   08:49:59.529246 +0100   Mock Generator  Failed to find extension point <private> in the binding map, scanning all extension points
error   08:49:59.529269 +0100   Mock Generator  Failed to find extension point data for <private>
default 08:49:59.529311 +0100   Mock Generator  plug-in sdk "com.apple.dt.Xcode.extension.source-editor" not registered
error   08:49:59.530006 +0100   Mock Generator  Failed to find extension point <private> in the binding map, scanning all extension points
error   08:49:59.530025 +0100   Mock Generator  Failed to find extension point data for <private>
default 08:49:59.530055 +0100   Mock Generator  plug-in sdk "com.apple.dt.Xcode.extension.source-editor" not registered
error   08:49:59.530796 +0100   Mock Generator  Failed to find extension point <private> in the binding map, scanning all extension points
error   08:49:59.530817 +0100   Mock Generator  Failed to find extension point data for <private>
default 08:49:59.530855 +0100   Mock Generator  plug-in sdk "com.apple.dt.Xcode.extension.source-editor" not registered
default 08:57:56.194962 +0100   pkd plugin /Applications/Swift Mock Generator for Xcode.app/Contents/PlugIns/Mock Generator.appex is still valid.
seanhenry commented 5 years ago

Thanks for the logs.

A quick google revealed this but the instructions to fix the problem are a little vague.

If that doesn't help then I would suggest posting your log on the Apple Developer website.

In the meantime, I'll take a closer look at Xcode 10.2 over the weekend.

seanhenry commented 5 years ago

Not sure if this will help but can you send the output of this:

pluginkit -m -p com.apple.dt.Xcode.extension.source-editor -A -D -vvv
dandreikiv commented 5 years ago

Hi @seanhenry, here is the output:

+    codes.seanhenry.MockGeneratorApp.XcodePlugin(0.18)
                Path = /Applications/Swift Mock Generator for Xcode.app/Contents/PlugIns/Mock Generator.appex
                UUID = C959D00B-31B1-4D1A-B1DF-A4D69AFD535C
           Timestamp = 2019-03-29 08:07:37 +0000
                 SDK = com.apple.dt.Xcode.extension.source-editor
       Parent Bundle = /Applications/Swift Mock Generator for Xcode.app
        Display Name = Mock Generator
          Short Name = Mock Generator
         Parent Name = Swift Mock Generator for Xcode

 (1 plug-in)
seanhenry commented 5 years ago

It's interesting that you only have 1 plugin. I have a couple of default plugins in my list:

+    com.apple.dt.XcodeBuiltInExtensions(10.2)
                Path = /Applications/Xcode-10.2.app/Contents/PlugIns/XcodeBuiltInExtensions.appex
                UUID = 391AA18B-226A-4BFC-BDDF-9520C0B2779C
           Timestamp = 2019-03-29 21:18:58 +0000
                 SDK = com.apple.dt.Xcode.extension.source-editor
       Parent Bundle = /Applications/Xcode-10.2.app
        Display Name = XcodeBuiltInExtensions
          Short Name = XcodeBuiltInExtensions
         Parent Name = Xcode-10.2

+    com.apple.dt.XCDocumenter.XCDocumenterExtension(1.0)
                Path = /Applications/Xcode-10.2.app/Contents/PlugIns/XCDocumenterExtension.appex
                UUID = D3E7FFE0-ECDD-4BE7-91FE-85CCD8B8195B
           Timestamp = 2019-03-29 21:18:58 +0000
                 SDK = com.apple.dt.Xcode.extension.source-editor
       Parent Bundle = /Applications/Xcode-10.2.app
        Display Name = XCDocumenterExtension
          Short Name = XCDocumenterExtension
         Parent Name = Xcode-10.2

+    codes.seanhenry.MockGeneratorApp.XcodePlugin(0.18)
                Path = /Applications/Swift Mock Generator for Xcode.app/Contents/PlugIns/Mock Generator.appex
                UUID = 8BE82F32-6AEF-40B3-8034-F61557008DBD
           Timestamp = 2019-02-11 15:23:09 +0000
                 SDK = com.apple.dt.Xcode.extension.source-editor
       Parent Bundle = /Applications/Swift Mock Generator for Xcode.app
        Display Name = Mock Generator
          Short Name = Mock Generator
         Parent Name = Swift Mock Generator

It makes me think there's a problem with your Xcode installation. Could you try to add the default plugins that I have to the plugin registry and see what output you get:

pluginkit -a -v /Applications/Xcode-10.2.app/Contents/PlugIns/XcodeBuiltInExtensions.appex
pluginkit -a -v /Applications/Xcode-10.2.app/Contents/PlugIns/XCDocumenterExtension.appex

(Make sure to replace Xcode-10.2.app with your Xcode app bundle name)

dandreikiv commented 5 years ago

I had fresh re-install of MacOS, with erasing of my hard drive and Xcode 10.2 was installed from AppStore.

seanhenry commented 5 years ago

Is the plugin working now?

I just had the same problem when I installed the new release that I just pushed. It disappeared from the Xcode menu and System Preferences -> Extensions and I fixed it by removing it and adding it from the plugin registry using the pluginkit cli:

pluginkit -r /Applications/Swift\ Mock\ Generator\ for\ Xcode.app/Contents/PlugIns/Mock\ Generator.appex
pluginkit -a /Applications/Swift\ Mock\ Generator\ for\ Xcode.app/Contents/PlugIns/Mock\ Generator.appex
dandreikiv commented 5 years ago

Hi @seanhenry, I have removed Xcode and the Mock Generator, after that I installed Xcode again from the AppStore and downloaded the new version of the Mock Generator - everything works now as it supposed to!!! Thank you for your help!

seanhenry commented 5 years ago

Great! I’m glad it’s working now :)