Sephiroth87 / Crayons

An Xcode plugin to improve dealing with colors in your project
MIT License
475 stars 6 forks source link

Doesn't work, menu entry doesn't show up #3

Open futuretap opened 8 years ago

futuretap commented 8 years ago

I tried to install via Alcatraz and opened the Main.storyboard in the Example app. In the color picker no custom entry shows up.

I also tried to install manually (Just hit Cmd-R and another copy of Xcode opens) => same problem.

Sephiroth87 commented 8 years ago

Did Xcode ask you to load the plugin? When you run from source, do you see any log entry marked with 🖍?

ehlersd commented 8 years ago

I'm having the same problem as @futuretap...

I've tried stepping thru the Crayons plugin, and the problem seems to be where the paletteNamesForClassNames: method isn't being called...so, the palette.name is empty and therefore is not added to the list. I confirmed with a breakpoint that this method was never being called.

Also, while forcing palette.name to be palette.classname (for testing purposes), the palette was added to the list, but with no colors....making me think that the colorsForClassesAndColorNames: method is also not being called (or so it seems).

Sephiroth87 commented 8 years ago

Ok, looks like the live views manager didn't start properly, can you check if the log shows this message?

"🖍 LiveViewsManager enabled"

ehlersd commented 8 years ago

No, not seeing it there....

Sephiroth87 commented 8 years ago

Ok, can you also check if opening one one files and changing something, then going back to the storyboard will trigger it?

ehlersd commented 8 years ago

No. I'm seeing the call to the p_populateColorsMenu: method in DVTColorPickerPopUpButton+Crayons.m, but not seeing any triggers of my breakpoints at the top of these methods:

or even:

Sephiroth87 commented 8 years ago

paletteNamesForClassNames and colorsForClassesAndColorNames are executed in a separate process, that's why the breakpoint will never trigger...

So the problem is - [IBStoryboardDocument classDescriber:didModifyClasses:], if that method is never called, the live view manager will not be enabled, and colors won't be generated... I'll have to find out why it's not called, never seen it not happen...

ehlersd commented 8 years ago

I gotcha. I haven't messed with any of this IB interfacing before, just really wanted to get this plugin working. :+1:

Let me know if I can be of any help.

Sephiroth87 commented 8 years ago

Thanks, any help will be greatly appreciated since I still haven't been able to reproduce it...

Can you try editing IBStoryboardDocument+Crayons.m

and add inside + (void)load the line

[self jr_swizzleMethod:NSSelectorFromString(@"setClassDescriber:") withMethod:@selector(p_setClassDescriber:) error:NULL];

and the method

- (void)p_setClassDescriber:(id)arg1
{
    [self p_setClassDescriber:arg1];
}

to the class and see if a breakpoints there is triggered...

dsnider commented 8 years ago

This is not working for me as well. Using Xcode 7.2 it did work for your example project and I made it work in a couple example Swift projects but for my reasonably complex Swift project, it is not working. It's not a plugin conflict as it works with other projects.

Sephiroth87 commented 8 years ago

I think that might be a different problem, I've seen a Swift project fail to index properly a couple of times, working on a fix for that...

timothycosta commented 8 years ago

I'm also having this problem now in my objective-c project. It was working last week. The selector shows when I use the color dropdown in IB, but when I mouse over the palette nothing is displayed.

I tried reinstalling Crayons, and reinstalling Alcatraz.

[Update] A few hours later and it's working again. No idea what changed but something seems flaky.

andrebraga commented 8 years ago

Just chiming in to kindly request that this bug receives some love from the plugin author. When it worked it was magic, when it stopped working (circa 2 months ago) it left me longing for more. :smiley:

Sephiroth87 commented 8 years ago

Hey everyone, just to let you know that the latest version might have solved your problems, and if it hasn't there's a branch called "bug_6" with a bunch of logging added that would really help me track down the issue :)

juniorklein commented 8 years ago

Hi @Sephiroth87,

I'm still having problems, even with the bug_6 branch.

Can you help me?

Thanks

juniorklein commented 8 years ago

Another info: The example project works like a charm, but in my project doesn't work.

juniorklein commented 8 years ago

More info: In a blank project works like a charm. In my project I have IB_DESIGNABLE's components and IBInspectable's properties. My project uses Cocoapods and because that works with workspace

juniorklein commented 8 years ago

Logs for a blank project when I open a color picker in IB:

2016-08-23 17:51:49.232 Xcode[25785:5088369] 🖍 updating palette classes 2016-08-23 17:51:49.370 Xcode[25785:5088369] 🖍 Document: <IBStoryboardDocument: 0x10704cc00> 2016-08-23 17:51:49.371 Xcode[25785:5088369] 🖍 Runtime: <IBCocoaTouchTargetRuntime: 0x608000157c30> 2016-08-23 17:51:49.371 Xcode[25785:5088369] 🖍 Manager: <IBLiveViewsManager: 0x608001cc2990>, 1 2016-08-23 17:51:49.371 Xcode[25785:5088369] 🖍 Platform: <IBCocoaTouchPlatformToolDescription: 0x608002a5c0e0> Designables 1x for IBCocoaTouchFramework-NineOneAndLater w/ default fidelity 2016-08-23 17:51:49.371 Xcode[25785:5088369] [MT] IBLiveViews: Launching remote tool for manager <IBLiveViewsManager: 0x608001cc2990>, targetRuntime <IBCocoaTouchTargetRuntime: 0x608000157c30>, scaleFactor 1x 2016-08-23 17:51:49.371 Xcode[25785:5088369] [MT] IBPlatformTool: Looking up device for type SimDeviceType : com.apple.dt.Xcode.IBSimDeviceType.iPad-1x and runtime SimRuntime : 9.3 (13E230) - com.apple.CoreSimulator.SimRuntime.iOS-9-3 2016-08-23 17:51:49.371 Xcode[25785:5088369] [MT] IBPlatformTool: Using SimDeviceSet at path: /Users/marioklein/Library/Developer/Xcode/UserData/IB Support/Simulator Devices 2016-08-23 17:51:49.372 Xcode[25785:5088369] [MT] IBPlatformTool: Picking device from available devices: ( "SimDevice : IBSimDeviceTypeiPad1x (09846646-028B-42B5-B7DC-BBE6A5E2268A) : state={ Shutdown } deviceType={ SimDeviceType : com.apple.dt.Xcode.IBSimDeviceType.iPad-1x } runtime={ SimRuntime : 9.3 (13E230) - com.apple.CoreSimulator.SimRuntime.iOS-9-3 }", "SimDevice : IBAppleTVSimDeviceType1080p (75860FF1-BB9F-40D1-9C6F-F84C38ED43C2) : state={ Shutdown } deviceType={ SimDeviceType : com.apple.dt.Xcode.IBSimDeviceType.AppleTV-1080p } runtime={ SimRuntime : 9.2 (13Y227) - com.apple.CoreSimulator.SimRuntime.tvOS-9-2 }" ) 2016-08-23 17:51:49.373 Xcode[25785:5088369] [MT] IBPlatformTool: Synchronously launching new tool for description (<IBCocoaTouchPlatformToolDescription: 0x608002a5c0e0> Designables 1x for IBCocoaTouchFramework-NineOneAndLater w/ default fidelity) with reason "Designables agent for rendering/geometry/etc for <IBCocoaTouchTargetRuntime: 0x608000157c30> @ 1x" 2016-08-23 17:51:49.373 Xcode[25785:5088369] [MT] IBPlatformTool: Going to launch tool at path /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/Library/Xcode/Overlays/IBDesignablesAgentCocoaTouch in execution context <IBSimulatorToolCoreSimulatorCLIExecutionContext: 0x608002a3a8c0> 2016-08-23 17:51:49.373 Xcode[25785:5088369] [MT] IBPlatformTool: Going to spawn platform tool via CoreSimulator for context <IBCocoaTouchToolLaunchContext: 0x60800666f140> toolName = IBDesignablesAgentCocoaTouch, description = <IBCocoaTouchPlatformToolDescription: 0x608002a5c0e0> Designables 1x for IBCocoaTouchFramework-NineOneAndLater w/ default fidelity on device SimDevice : IBSimDeviceTypeiPad1x (09846646-028B-42B5-B7DC-BBE6A5E2268A) : state={ Shutdown } deviceType={ SimDeviceType : com.apple.dt.Xcode.IBSimDeviceType.iPad-1x } runtime={ SimRuntime : 9.3 (13E230) - com.apple.CoreSimulator.SimRuntime.iOS-9-3 } 2016-08-23 17:51:49.373 Xcode[25785:5088369] 🖍 Launching: IBDesignablesAgentCocoaTouch 2016-08-23 17:51:49.374 Xcode[25785:5088369] [MT] IBPlatformTool: Spawning with FIFOs /var/folders/b4/ycrxh67n6pg5vtnrnt935zt80000gn/T/Xcode-25785/IB/6B095936-DF4E-438F-A4FA-B2F5DAEF11C8.HostToRemote and /var/folders/b4/ycrxh67n6pg5vtnrnt935zt80000gn/T/Xcode-25785/IB/6B095936-DF4E-438F-A4FA-B2F5DAEF11C8.RemoteToHost 2016-08-23 17:51:49.376 Xcode[25785:5088369] [MT] IBPlatformTool: Spawned IBDesignablesAgentCocoaTouch with pid 25860 but waiting to connect 2016-08-23 17:51:49.549 IBDesignablesAgentCocoaTouch[25860:5093959] 🖍 📱 framework loaded 2016-08-23 17:51:49.569 Xcode[25785:5088369] [MT] IBPlatformTool: Connected to IBDesignablesAgentCocoaTouch with pid 25860 2016-08-23 17:51:49.569 Xcode[25785:5088369] [MT] IBMessageChannel: Sending message loadExtensions: 2016-08-23 17:51:49.570 Xcode[25785:5088369] [MT] IBMessageChannel: Received reply with status 0, returnValueData = 0 bytes 2016-08-23 17:51:49.570 Xcode[25785:5088369] [MT] IBPlatformTool: Skipping sending auto-attach PID to host Xcode: allowsAutoAttach=0, pid=25860 2016-08-23 17:51:49.571 Xcode[25785:5088369] [MT] IBLiveViews: Loading bundles for remote tool <IBCocoaTouchToolProxy: 0x6000014d7df0>: ( "<IBBuiltLiveViewsBundleInstance: 0x608002e36e00>" ) 2016-08-23 17:51:49.571 Xcode[25785:5088369] [MT] IBMessageChannel: Sending message loadBuiltLiveViewBundleInstances: 2016-08-23 17:51:49.576 Xcode[25785:5088369] [MT] IBMessageChannel: Received reply with status 0, returnValueData = 507 bytes 2016-08-23 17:51:49.576 Xcode[25785:5088369] [MT] IBMessageChannel: ==> return value = <IBMarshallingResult: 0x60800223d0c0> 2016-08-23 17:51:49.576 Xcode[25785:5088369] [MT] IBLiveViews: Succeeded to load 1 bundle for <IBCocoaTouchToolProxy: 0x6000014d7df0> 2016-08-23 17:51:49.576 Xcode[25785:5088369] 🖍 Tool: <IBCocoaTouchToolProxy: 0x6000014d7df0> 2016-08-23 17:51:49.576 Xcode[25785:5088369] 🖍 FailedLoadResult: (null) 2016-08-23 17:51:49.577 Xcode[25785:5088369] 🖍 updating missing palette names: {( GooglePalette )} 2016-08-23 17:51:49.577 Xcode[25785:5091052] IBMessageChannel: Sending message registerFontsAtURLs: 2016-08-23 17:51:49.589 Xcode[25785:5091052] IBMessageChannel: Received reply with status 0, returnValueData = 18 bytes 2016-08-23 17:51:49.590 Xcode[25785:5091052] IBMessageChannel: ==> return value = <(null): 0x0> 2016-08-23 17:51:49.590 Xcode[25785:5088369] [MT] IBMessageChannel: Sending message paletteNamesForClassNames: 2016-08-23 17:51:49.591 Xcode[25785:5088369] [MT] IBMessageChannel: Received reply with status 0, returnValueData = 197 bytes 2016-08-23 17:51:49.591 Xcode[25785:5088369] [MT] IBMessageChannel: ==> return value = <__NSDictionaryM: 0x608002c423d0> 2016-08-23 17:51:49.591 Xcode[25785:5088369] 🖍 Error: (null) 2016-08-23 17:51:49.591 Xcode[25785:5088369] 🖍 got names: { GooglePalette = "Google Material Palette"; } 2016-08-23 17:51:49.591 Xcode[25785:5088369] 🖍 updating missing colors: { GooglePalette = ( grey, white, orange, lime, indigo, blue, red, lightBlue, green, brown, amber, teal, deepOrange, pink, lightGreen, deepPurple, purple, black, cyan, yellow, blueGrey ); } 2016-08-23 17:51:49.591 Xcode[25785:5088369] [MT] IBMessageChannel: Sending message colorsForClassesAndColorNames: 2016-08-23 17:51:49.593 Xcode[25785:5088369] [MT] IBMessageChannel: Received reply with status 0, returnValueData = 5360 bytes 2016-08-23 17:51:49.594 Xcode[25785:5088369] [MT] IBMessageChannel: ==> return value = <__NSDictionaryM: 0x608002c42ca0> 2016-08-23 17:51:49.594 Xcode[25785:5088369] 🖍 got colors: { GooglePalette = { amber = { A = 1; B = "0.02745098039215686"; G = "0.7568627450980392"; R = 1; }; black = { A = 1; B = 0; G = 0; R = 0; }; blue = { A = 1; B = "0.9529411764705882"; G = "0.5882352941176471"; R = "0.1294117647058824"; }; blueGrey = { A = 1; B = "0.5450980392156862"; G = "0.4901960784313725"; R = "0.3764705882352941"; }; brown = { A = 1; B = "0.2823529411764706"; G = "0.3333333333333333"; R = "0.4745098039215686"; }; cyan = { A = 1; B = "0.8313725490196079"; G = "0.7372549019607844"; R = 0; }; deepOrange = { A = 1; B = "0.1333333333333333"; G = "0.3411764705882353"; R = 1; }; deepPurple = { A = 1; B = "0.7176470588235294"; G = "0.2274509803921569"; R = "0.403921568627451"; }; green = { A = 1; B = "0.3137254901960784"; G = "0.6862745098039216"; R = "0.2980392156862745"; }; grey = { A = 1; B = "0.6196078431372549"; G = "0.6196078431372549"; R = "0.6196078431372549"; }; indigo = { A = 1; B = "0.7098039215686275"; G = "0.3176470588235294"; R = "0.2470588235294118"; }; lightBlue = { A = 1; B = "0.9568627450980393"; G = "0.6627450980392157"; R = "0.01176470588235294"; }; lightGreen = { A = 1; B = "0.2901960784313726"; G = "0.7647058823529411"; R = "0.5450980392156862"; }; lime = { A = 1; B = "0.2235294117647059"; G = "0.8627450980392157"; R = "0.803921568627451"; }; orange = { A = 1; B = 0; G = "0.596078431372549"; R = 1; }; pink = { A = 1; B = "0.3882352941176471"; G = "0.1176470588235294"; R = "0.9137254901960784"; }; purple = { A = 1; B = "0.6901960784313725"; G = "0.1529411764705882"; R = "0.611764705882353"; }; red = { A = 1; B = "0.2117647058823529"; G = "0.2627450980392157"; R = "0.9568627450980393"; }; teal = { A = 1; B = "0.5333333333333333"; G = "0.5882352941176471"; R = 0; }; white = { A = 1; B = 1; G = 1; R = 1; }; yellow = { A = 1; B = "0.2313725490196079"; G = "0.9215686274509803"; R = 1; }; }; }

juniorklein commented 8 years ago

Logs for a my project when I open a color picker in IB: 2016-08-23 17:59:19.861 Xcode[26131:5128428] [MT] IBPlatformTool: Synchronously requesting cached tool: got cached tool 0x6000024ccb70 for description (<IBCocoaTouchPlatformToolDescription: 0x600004656e30> System content 1x for IBCocoaTouchFramework-NineOneAndLater w/ default fidelity) with reason "Asking <IBUITabBar: 0x125333820> for values of key paths [ibLayoutInset, intrinsicContentSize, baselineOffsetFromBottom, ibShadowedFirstBaselineOffsetFromTop, ibLayoutMargins, itemFramesArray, titleRectsArray]" 2016-08-23 17:59:19.862 Xcode[26131:5128428] [MT] IBMessageChannel: Sending message valuesForKeyPaths:ofMarshalledObjectRequest:resultMarshallerClassNames:resultMarshallerContexts: 2016-08-23 17:59:19.873 Xcode[26131:5128428] [MT] IBMessageChannel: Received reply with status 0, returnValueData = 486 bytes 2016-08-23 17:59:19.874 Xcode[26131:5128428] [MT] IBMessageChannel: ==> return value = <__NSArrayM: 0x60000485db80> 2016-08-23 17:59:21.663 Xcode[26131:5128428] 🖍 Document: <IBStoryboardDocument: 0x118399000> 2016-08-23 17:59:21.663 Xcode[26131:5128428] 🖍 Runtime: <IBCocoaTouchTargetRuntime: 0x608000157a20> 2016-08-23 17:59:21.663 Xcode[26131:5128428] 🖍 Manager: <IBLiveViewsManager: 0x6080018d1aa0>, 1 2016-08-23 17:59:21.664 Xcode[26131:5128428] 🖍 Platform: <IBCocoaTouchPlatformToolDescription: 0x608003e55030> Designables 1x for IBCocoaTouchFramework-NineOneAndLater w/ default fidelity 2016-08-23 17:59:21.664 Xcode[26131:5128428] [MT] IBLiveViews: Using existing remote tool <IBCocoaTouchToolProxy: 0x6000026d4120> for manager <IBLiveViewsManager: 0x6080018d1aa0>, targetRuntime <IBCocoaTouchTargetRuntime: 0x608000157a20>, scaleFactor 1x 2016-08-23 17:59:21.664 Xcode[26131:5128428] [MT] IBLiveViews: Loading bundles for remote tool <IBCocoaTouchToolProxy: 0x6000026d4120>: ( "<IBBuiltLiveViewsBundleInstance: 0x608003c33540>" ) 2016-08-23 17:59:21.664 Xcode[26131:5128428] [MT] IBMessageChannel: Sending message loadBuiltLiveViewBundleInstances: 2016-08-23 17:59:21.665 Xcode[26131:5128428] [MT] IBMessageChannel: Received reply with status 0, returnValueData = 507 bytes 2016-08-23 17:59:21.665 Xcode[26131:5128428] [MT] IBMessageChannel: ==> return value = <IBMarshallingResult: 0x608002a277e0> 2016-08-23 17:59:21.665 Xcode[26131:5128428] [MT] IBLiveViews: Succeeded to load 1 bundle for <IBCocoaTouchToolProxy: 0x6000026d4120> 2016-08-23 17:59:21.665 Xcode[26131:5128428] 🖍 Tool: <IBCocoaTouchToolProxy: 0x6000026d4120> 2016-08-23 17:59:21.665 Xcode[26131:5128428] 🖍 FailedLoadResult: (null) 2016-08-23 17:59:21.666 Xcode[26131:5128428] 🖍 updating missing palette names: {( GooglePalette, UIColor, ColorPalette )} 2016-08-23 17:59:21.666 Xcode[26131:5128428] [MT] IBMessageChannel: Sending message paletteNamesForClassNames: 2016-08-23 17:59:21.667 Xcode[26131:5128428] [MT] IBMessageChannel: Received reply with status 0, returnValueData = 153 bytes 2016-08-23 17:59:21.667 Xcode[26131:5128428] [MT] IBMessageChannel: ==> return value = <__NSDictionaryM: 0x60800424db90> 2016-08-23 17:59:21.667 Xcode[26131:5128428] 🖍 Error: (null) 2016-08-23 17:59:21.667 Xcode[26131:5128428] 🖍 got names: { UIColor = UIColor; } 2016-08-23 17:59:21.668 Xcode[26131:5128428] 🖍 updating missing colors: { ColorPalette = ( mainColor ); GooglePalette = ( grey, white, orange, lime, indigo, blue, red, lightBlue, green, brown, amber, teal, deepOrange, pink, lightGreen, deepPurple, purple, black, cyan, yellow, blueGrey ); } 2016-08-23 17:59:21.668 Xcode[26131:5128428] [MT] IBMessageChannel: Sending message colorsForClassesAndColorNames: 2016-08-23 17:59:21.670 Xcode[26131:5128428] [MT] IBMessageChannel: Received reply with status 0, returnValueData = 59 bytes 2016-08-23 17:59:21.670 Xcode[26131:5128428] [MT] IBMessageChannel: ==> return value = <__NSDictionaryM: 0x608004043b10> 2016-08-23 17:59:21.670 Xcode[26131:5128428] 🖍 got colors: { }

In log I found a strange diff. The last log "🖍 got colors" when is in my project.