Reputation: 1502
I just upgraded Xcode to 8.0 (8A218a) and am converting my project in Swift 2.3 to Swift 3.0. The only issue left now is this error:
"Exception while running ibtool: Cannot find value transformer with name UTIToIconTransformer"
The UTIToIconTransformer
is defined something like:
@objc(UTIToIconTransformer) class UTIToIconTransformer : ValueTransformer {
// ...
}
The code worked fine when it was in Swift 2.3. The binding using this value transformer is set like this:
If I remove this binding, the app runs, and the row titles are shown correctly.
I have tried calling NSValueTransformer.setValueTransformer()
in the app delegate's +initialize()
, in applicationDidFinishLaunching
and in the value transformer's +initialize()
, as suggested here, here at StackOverflow and here at NShipster (Though I don't think the statement of "Typically, the singleton instance would be registered in the +initialize method of the value transformer subclass, so it could be used without further setup." complies with the Apple's doc.), all without success.
In the Apple's doc, it says
Value transformers are typically registered by an application’s delegate
class, in response to receiving a initialize: class message. This allows
registration to occur early in the application startup process, providing
access to the value transformers as nib files load.
Availability in Interface Builder
Your NSValueTransformer subclasses are not automatically listed in the
Interface Builder bindings inspector. When inspecting a binding you can enter
the name that the value transformer is registered with, but the functionality
will not be present in Interface Builder’s test mode. When your application
is compiled and run the transformer will be used.
But registering in the AppDelegate
's override class func initialize()
didn't help. In Xcode 7 and Swift 2.3, it even worked without the registration.
Upvotes: 0
Views: 636
Reputation: 1502
Finally I solved the problem by removing the NSOutlineView
from the storyboard and setting up a new one.
I have another project which also has an outlineview binded with an NSTreeController
, and that project has no problem after the Xcode 8.0 upgrade. Then I tried creating a new ValueTransformer
with a new name, with no luck.
I guess there may be something wrong with the storyboard, so I tried recreating the outline view. Then Xcode doesn't complain that it can't find the transformers!
Upvotes: 0