- Home /
Conflict between two iOS plugins overriding AppControllerClassName
I am developping an iOS application using two plugins.
These two plugins try to override the AppControllerClassName
constant as soon as they get loaded, using the IMPL_APP_CONTROLLER_SUBCLASS
macro defined in the UnityAppController.mm
. However, this causes a conflict when running the app. The latter crashes when it starts, and throws the following error :
Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[XXX setGameObjectName:]: unrecognized selector sent to instance YYY'
Has anyone faced the same problem and found a solution to prevent this?
Someone on Github suggested to do the following without giving more information.
Try to move all the implementation block of the 1st plugin into the 2nd one, or change the 1st plugin
.mm
file to be a category of 2nd plugin's app controller instead of being a subclass of the unity app controller.
@eppz : I saw your blog post here but I was unable to apply this to the existing plugins I currently use.
If you don't have experience in a field then you should learn it and gain experience before flooding the knowledge base.
Haha, nice try @EvOxOPTICSx. I did try to do the job by myself, I can't post the things I tried because the plugins I use are paid. And on the contrary of you, it's not a trivial question about how many arguments I have to put when calling a function. I was trying to merge two native iOS plugins because the creators of the plugins did not do their job correctly.
Hello,
Have you been able to understand how to solve this by yourself since then?
Answer by eppz · May 26, 2018 at 03:01 PM
@Hellium I think you can hook them up serially. Just make PluginA a subclass of UnityAppController, then make PluginB a subclass of PluginA (also, override PluginA methods by calling superclass implementations at the start of each method), then use PluginB only. You cannot work this around without modding the plugins themselves. This is why I think the current plugin architecture is broken.
Thanks a lot for your quick answer eppz ! I don't have any experience with native mobile development, but I will give it any try tomorrow and I will let you know. Thanks again !
Well, subclassing is all the same in Objective-C as well.
@eppz : I haven't been able to merge the two plugins.... Objective-C is such an horrible language..... But I have contacted someone fluent with this language to help me.
Thanks again eppz for your help!
Your answer
Follow this Question
Related Questions
What does Texture.GetNativeTexturePtr() return when using Metal? 1 Answer
Writing unity ios plugin in Swift 1 Answer
Native plugin problems with varargs on iOS (Opus) 0 Answers
Memory problem with UIImagePickerViewController 0 Answers
Docs say managed-to-unmanaged calls are very slow on iOS. Why? Will it be fixed? 0 Answers