Exception while running ibtool: Cannot find value transformer with name - xcode

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.

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!

Related

Calling Xamarin.Android Interop from Xamarin.UITest

I've created a method in the first Activity of my app which I have added the Java.Interop.Export tag to, as below.
[Export]
public string MyInvokeMethod(string myString)
{
_webview.LoadUrl("http://www.google.co.uk");
return "test";
}
And I'm trying to call this method in Xamarin.UITest with the below.
app.Invoke("MyInvokeMethod","test");
However, nothing seems to happen. I looked into the logs of the Android device and it seems as though it is trying to call the method but it gets below error.
"Method not found with correct argument types. Trying to type convert."
Is there a way to get this to work? I have tried with passing an argument, without passing an argument, adding a name for the method in the attribute but nothing has worked.
EDIT
After speaking to one of the Xamarin developers they believe it might be an issue with how MvvmCross handles the Android Activity.
I think you should add
[Export("myInvokeMethod:")]
on top of your method, instead of only add [Export]
Someone using xamarin uitests might find this useful too: https://forums.xamarin.com/discussion/57662/xamarin-forms-uitest

Parse.com not working on OSX (Swift)

I am trying to use Parse.com SDK in my Mac OSX app written in swift. I have followed the Quickstart Guide and used a bridging header but when I launch the app I am shown this message and the object is not created on launch.
Failed to set (contentViewController) user defined inspected property on (NSWindow): You have to call setApplicationId:clientKey: on Parse to configure Parse.
Any Ideas?
Thanks
I just ran into the same issue, for some reason the viewDidLoad() on the view controllers are executing before the app delegate's applicationDidFinishLaunching: method.
Although Parse recommends having their methods setup in the app delegate, setting up the app id/client key on your initial view's viewDidLoad will let you use parse normally.

Binding issue between Core Data and NSArrayController

I am trying to set up the binding between Core Data, NSArraycountroller and a NSTableView. To get a NSManagedObjectContext for the NSArrayController. I dragged an NSObject in the IB, and named it after the appDelegate and then set up the binding of objectContext between appDelegate and the arrayController.
However, whenever I tried to run the app. I get this error message:
The error message:
The managed object model version used to open the persistent store is incompatible with
the one that was used to create the persistent store
And then followed by another error message:
Failed to initialize store.
I googled around, most of the people can solve this issue by clean their project or delete the files under ~/Library/Application Support/AppName/.. But I don't have luck with those.
Another thing is that, I desperately want some good tutorial on this topic (CoreData+ArrayController+TableView). Can someone shed some light on this as well? I read through the chapter 11 of the book "Cocoa Programming for Mac OSX 4th version", but didn't find it really helpful.
Thanks.
Finally solved this issue. I think it has to do with Reskit. Reskit has its own managedObjectContext when bundle with CoreData. That's why it keeps telling me the two object model is incompatible. The NSArrayController should be binded to the managedObjectContext in RKManager instead of the one in appDelegate.
So I put this in the init method of view controller:
RKObjectManager *objectManager = [RKObjectManager sharedManager];
currentObjectContext = objectManager.objectStore.managedObjectContextForCurrentThread;
And point the managedObjectContext in the NSArrayController object to the currentObjectContext.
The error has to do with your managed object model; it's not related to your bindings or table view. If it happens when you run the app (vs. when you try to open a document) it's probably during restoration of autosaved documents.
Try deleting anything related from ~/Library/Autosave Information and seeing if that fixes the initial problem.

Quartz Composer "Binding Controls to Input Ports" in Xcode 4.x

I am trying to follow "Binding Controls to Input Ports" of Quartz Composer Programming Guide.
The document says :
5.Click “Bind to” and then choose Patch Controller in the “Bind to” popup menu.
6.Enter patch in the Controller Key text field.
7.Enter text.value in the Model Key Path text field.
In my project of Xcode (4.2 &) 4.3, the Controller Key text field is disabled. The Model Key Path text field requires an object of QCPatch class, which I don't think I have a clue.
Should I install Xcode 3.x and handle this & convert to 4.x? Any advice ?
I am experiencing the same issues, however via the kineme forums I have found a work around:
using the Object Controller instead of the Qc Patch Controller:
make a new cocoa project...
add quartz framework via buid phases tab and import the framework to your project either in the pre compile header, or app delegate...
add qc view to your xib and load your composition
add object controller to your xib...
change object controllers class to "QCView" without quotes.
control drag your object controller to your qc view and select "content"
add a slider and bind its value to your object controller and set its model key path to "patch.Text.value" without quotes.....
see this for the full thread on this topic.
in xib file choose the QCView
Attibutes Inspector -> check "Forwards All Events"
hope it helps

NSArrayController and referring to a shared, static, Core Data based library

Using this guide I have created a static library (let's call it AppCore) that can be shared between the Mac OS X and iOS versions of one app. This static library uses Core Data and the point of it is to share the model part and schema versioning between different implementations.
I created a NSPersistentDocument based project that will depend on this AppCore. In this project I added a reference to the .xcdatamodel file. Then I created a simple table view with add/remove buttons to edit an array of one entity type with the assisted "new core data entity" item. This created an instance of NSArrayController and the required bindings for the add/remove behaviour.
Now, everything seems to work fine when I'm using the default class for the Core Data entities (NSManagedObject) and I'm able to add new rows using the +/- buttons. However, when I change the entity implementation class to a custom one, I'm getting an error
Failed to create new object
This seems to come from the NSArrayController and it seems to be unable to instantiate the required entity. I can, however, create one in the NSPersistentDocument subclass by:
[NSEntityDescription insertNewObjectForEntityForName:#"SomeEntity" inManagedObjectContext:[self managedObjectContext]]
What confuses me is why the instance of NSArrayController can't. If I understand correctly, the array controller is instructed to create an entity, not class and my guess is that the entities are created with the help of NSEntityDescription class. I could implement my own version of the array controller's add: but then again, it might be that here something is fundamentally wrong. I haven't touched the init:s and the custom entity class implementation is simply for convenience, to access the attributes directly.
I have tried changing the base SDK on the AppCore but without effect. Currently it uses the iOS version but I'm not sure how it should be. This is another question but if unrelated, I might ask it here on a separate question.
So, to summarize, why can't the NSArrayController create an instance of this entity?
Thanks in advance.
Update
This works if I add the SomeEntity class from the AppCore to the dependent project as a reference. This is not the most usable way since modifications to the AppCore has to be propagated to the dependatnt projects also.
Bingo. I missed the "-ObjC" flag for the dependant project's "other linker flags". Now everything works like a charm.

Resources