-
Notifications
You must be signed in to change notification settings - Fork 68
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
valueForUndefinedKey "currentUnityController": Crash #51
Comments
I have used this tutorial before with no issues, but I just tried it in a new project and I'm getting the exact same issue. |
I could able to resolve the issue by integrating unity to my existing codebase as I am able to locate the currentUnityController object created in app's bridging header file under derived sources. I somehow feel this have something to do with a new project or the bridging headers are not connected well. Still confused! |
I was able to fix it by going to the 'Build Settings' for the target and setting 'Swift Language Version' from 4.0 to 3.2. It seems to be an issue with Swift classes in general not being key value coding-compliant, whereas Objective-C classes almost always are because most are a subclass of NSObject. ****However, this is not a long-term solution. I hope that Apple updates Xcode 9 to support this or introduces a feasible fix. Or Unity could too, I guess. |
Indeed! it worked... Thanks for your help. Appreciated! |
Hi, If you want to continue to use Swift 4.0, only you need to do is:
In Swift 4.0, when you need to access the swift code in the ObjectC code you have to put "@objc" before the attribute. You can see this in: https://developer.apple.com/library/content/documentation/Swift/Conceptual/BuildingCocoaApps/InteractingWithObjective-CAPIs.html |
I tried that earlier, but can't able to make that work. However I will still give that a try! Thanks |
This worked great. Thank you @igoredington! |
After below line its crashing:
UnityAppController* currentUnityController = (UnityAppController *)[delegate valueForKey:@"currentUnityController"];
***Terminating app due to uncaught exception 'NSUnknownKeyException', reason: '[ valueForUndefinedKey:]: this class is not key value coding-compliant for the key currentUnityController.
Any help please?
The text was updated successfully, but these errors were encountered: