Wizcorp / phonegap-plugin-wizCanvas

WizCanvas allows a developer to create a ultra-performant native canvas component. The view is based on the Ejecta framework and has WebGL support.
MIT License
43 stars 13 forks source link

load() & create() issues iOS #48

Open bassemBMI opened 8 years ago

bassemBMI commented 8 years ago

Hi, I try to use this plugin in iOS to solve "a video stream placed on top of the HTML view" issue. but I have errors with create() or load() functions:

console.log(wizCanvas); ==> {name: "mainView", views: Object, throwError: function, create: function, remove: function, ...}

wizCanvas.create('mainView',{}, function(success){console.log('success',success);}, function(fail){console.log('fail', fail);}); ==> fail - null

wizCanvas.show('mainView',{}, function(success){console.log('success',success);}, function(fail){console.log('fail', fail);}); ==> TypeError: undefined is not an object (evaluating 'this.views[name].show')

Same error for wizCanvas.load(); ==> TypeError: undefined is not an object (evaluating 'this.views[name].load')

Do I missed something in the configuration ?

ronkorving commented 8 years ago

If creation fails, there's no point in trying to show/load it (so the 2nd error is no surprise). I'm not sure why it would fail with a null error object though :-/

jrouault commented 8 years ago

mainView is a name reserved for the Cordova window. So you can not create a view with this name. Please try using another name.

ronkorving commented 8 years ago

It should in any case return an error response in the failure callback. It could have contained what you just said and would have avoided this issue.

jrouault commented 8 years ago

I agree with your statement. Contributions are more than appreciated too.

ronkorving commented 8 years ago

I don't know much about PhoneGap plugin development, but it seems the source of the solution would be here? https://github.com/Wizcorp/phonegap-plugin-wizCanvas/blob/master/platforms/ios/HelloCordova/Plugins/WizCanvasPlugin/WizCanvasPlugin.m#L98 (iOS)

@bassemBMI If you wanna make a PR to address this, that would be nice. Alternatively, we can first make an issue that describes this problem. There currently aren't many contributors on wizCanvas unfortunately.

bassemBMI commented 8 years ago

Thanks for your responses. I tried with "mainView" because using any other names does not return any response (no success nor fail).

jrouault commented 8 years ago

The following code returns the success callback in the example app provided in the repo: wizCanvas.create('test',{}, function(success){console.log('success',success);}, function(fail){console.log('fail', fail);});

Could you please provide more informations such as logs in XCode and your iOS version? Or a minimal project which have this issue?

bassemBMI commented 8 years ago

the iOS version is 8.1.1. I will check the Xcode log later (I remove the plugin from the project right now). console.log(wizCanvas()) return an object (described in my first comment), this mean that the plugin was loaded successfully ? If yes why the load function doesn't work (it supposed to look for index.js file and load it automatically if exist, but is not the case).

jrouault commented 8 years ago

I'm not sure what went wrong only from that. Did you add this code after cordova initialization? Can you provide a minimal project where you have this issue?