Skip to content
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

我想在capacitor上面使用这个,请问怎么使用? #101

Open
UTSOURCE opened this issue Apr 22, 2020 · 8 comments
Open

我想在capacitor上面使用这个,请问怎么使用? #101

UTSOURCE opened this issue Apr 22, 2020 · 8 comments

Comments

@UTSOURCE
Copy link

我想在capacitor上面使用这个,请问怎么使用?谢谢,能否指导下

@lovelyelfpop
Copy link
Collaborator

没用过 capacitor

@UTSOURCE
Copy link
Author

嗯啊,

@raykin
Copy link

raykin commented Nov 6, 2020

我尝试在capacitor中使用,然后xcode报错了。不太理解是个什么错误。
To Native Cordova -> ImagePicker getPictures ImagePicker239669295 ["options": [{
enablePickOriginal = 1;
height = "-1";
maximumImagesCount = 1;
quality = 80;
width = "-1";
}]]
2020-11-06 15:54:13.452196+0800 App[13352:5407318] *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '*** -[NSBundle initWithURL:]: nil URL argument'
*** First throw call stack:
(

@UTSOURCE
Copy link
Author

UTSOURCE commented Nov 6, 2020

@raykin 你怎么安装的?

@raykin
Copy link

raykin commented Nov 6, 2020

@UTSOURCE 我是按照官方https://capacitorjs.com/docs/cordova/migrating-from-cordova-to-capacitor 来迁移capacitor, 它自动识别了ImagePicker. 运行在simulator里就挂了。cordova是能够运行ImagePicker的,所以原来的项目是用cordova安装过的。

然后我卸载了ImagePicker(npm uninstall) 再装了一次 npm install https://github.com/giantss/cordova-plugin-ImagePicker.git.
capacitor的官方说安装插件用npm,所以用的这个方法。capacitor自己也识别出来了这个插件。
⠹ copy Found 14 Cordova plugins for ios
cordova-plugin-app-version (0.1.9)
cordova-plugin-crop (0.4.0)
cordova-plugin-file (6.0.2)
cordova-plugin-file-transfer (1.7.1)
cordova-plugin-geolocation (4.0.2)
cordova-plugin-imagepicker (1.2.2)
cordova-plugin-inappbrowser (4.0.0)
cordova-plugin-network-information (2.0.2)
cordova-plugin-request-location-accuracy (2.3.0)
cordova-plugin-screen-orientation (3.0.2)
cordova-plugin-camera (5.0.0)
cordova-plugin-document-viewer (1.0.0)
cordova-plugin-googleplus (8.5.1)
cordova-sqlite-storage (5.1.0)

我正准备用cordova plugin方法再装一次看看。因为迁移capacitor会影响插件,所以我重新运行了一个新项目来测试。才意识到这个有可能有影响。因为
~/code/goodmovesapp (master ✘)✹✭ ᐅ cordova plugin ls
No plugins added. Use cordova plugin add <plugin>.

@UTSOURCE
Copy link
Author

UTSOURCE commented Nov 6, 2020

@raykin 应该是需要改js和原生交互的 js部分,才不会报ImagePicker的问题,但是我不会,

@raykin
Copy link

raykin commented Nov 6, 2020

@UTSOURCE 感觉应该是JS的参数传导吧。我试了cordova安装也没用。
~/code/goodmovesapp (master ✘)✹✭ ᐅ cordova plugin ls
cordova-plugin-imagepicker 1.2.2 "ImagePicker"
我现在这个新项目只有一个cordova插件。但是capacitor却能识别出其他的插件,确切的说是识别了package.json里cordova里面的配置。这里有个有意思的测试。capacitor识别了ImagePicker和ScreenOrientation.
ImagePicker在simulator里跑不过。但是ScreenOrientation却能测试通过。这里面的主要区别我估计是因为ScreenOrientation是通过@ionic-native 来调用的。https://github.com/ionic-team/ionic-native

@UTSOURCE
Copy link
Author

UTSOURCE commented Nov 6, 2020

@raykin 对,

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants