Comments (8)
Hi Leo,
You definitely can, though this bridge will provide you only with the js to ios messaging part. If you want a working solution out of the box you would be better off with one of the larger frameworks like trigger.io, PhoneGap, etc.
Let me know if you need help with anything particular!
Cheers,
Marcus
-- while mobile
On Mar 19, 2012, at 4:45 PM, [email protected] wrote:
Hi Marcus, thanks for yours great code. I was wondering if it would be possible to trigger an UIImagePickerController from the javascript, choose a photo and give it back to the javascript? I would like to use it as a workaround for file upload which is unavailable on safari. Any guidance would be much appreciates.
Many thanks,
Leo
Reply to this email directly or view it on GitHub:
#8
from webviewjavascriptbridge.
Hi Marcus, many thanks for your quick response and suggestions. I had a look at trigger.io. It's a nice piece of software but I really could be doing with having some example code on how an image would be passed from a UIImagePicker to the javascript, in order to upload the file to a given site. Any suggestions would be much appreciated.
from webviewjavascriptbridge.
I don't think you'd want to pass the entire image from obj-c memory to
javascript memory. Once you have the image in obj-c memory, why not send it
right up to the server? I understand this means writing obj-c code instead
of javascript code, but if you're writing an iOS app you will sooner or
later have to write a bunch of obj-c.
If we were hell bent on passing the image data from obj-c to javascript I
imagine you may run in to a bunch of issues converting the image to a
string for sending it to the JS.
If you do decide to go the obj-c route, I could recommend checking out
AFNetworking: https://github.com/AFNetworking/AFNetworking/. See the "File
Upload with Progress Callback" title on that page for some example code.
Best of luck!
Marcus
On Tue, Mar 20, 2012 at 4:26 PM, leomcg18 <
[email protected]
wrote:
Hi Marcus, many thanks for your quick response and suggestions. I had a
look at trigger.io. It's a nice piece of software but I really could be
doing with having some example code on how an image would be passed from a
UIImagePicker to the javascript, in order to upload the file to a given
site.
Reply to this email directly or view it on GitHub:
My code http://github.com/marcuswestin
My latest http://twitter.com/marcuswestin
from webviewjavascriptbridge.
I agree with Marcus on avoiding the memory duplication. If not possible, it's easy to send a NSData* to javascript using base64, and webkit has an atob function to decode. I've already use this succesfully.
from webviewjavascriptbridge.
Good point on base64 encoding - that would do it just fine.
But if you're shipping a native client you may as well do this part natively. You'll get other nice things like upload progress and resuming if you do.
-- while mobile
On Mar 20, 2012, at 8:40 PM, Sebastian [email protected] wrote:
I agree with Marcus on avoiding the memory duplication. If not possible, it's easy to send a NSData* to javascript using base64, and webkit has an atob function to decode. I've already use this succesfully.
Reply to this email directly or view it on GitHub:
#8 (comment)
from webviewjavascriptbridge.
I'm going to close this as it's not really an issue with the bridge. Cheers!
from webviewjavascriptbridge.
Hey @leomcg18, you may find this post very relevant: http://trigger.io/cross-platform-application-development-blog/2012/03/23/using-parse-and-trigger-io-for-cross-platform-apps-without-pain-in-the-back-end/
from webviewjavascriptbridge.
Thanks Marcus, I'll take a look.
from webviewjavascriptbridge.
Related Issues (20)
- this project is in maintenance? 项目不在维护了吗? HOT 1
- 提交审核被拒,因为使用了UIWebView,有办法解决吗? HOT 8
- iOS UIWebview replacement to WKWebview HOT 4
- Web view is blank after creating the bridge object HOT 1
- iOS14.6 WebViewJavascriptBridge not work but iOS14.3 works HOT 1
- Hello
- Why don't work in iPad Air (14.1) ? HOT 2
- nice
- iOS 15.4 js 交互不走decidePolicyFor 这个代理方法了 HOT 2
- Mac OSX app Packages printed in version 10.15 and above crashed in system 10.14 and below, so far the problem has not been located HOT 1
- nice
- nice
- 我已经重构了这个库,10分钟就能完成接入,也许可以帮助你. HOT 2
- 按照README 第四步拷贝的js代码可能不起作用 HOT 1
- failed assertion `Draw Errors Validation
- Mambamessage
- Installed with CocoaPods in Xcode 15 beta 6 can not build module 'WebKit' HOT 9
- I think that if you no longer maintain this library, then it is recommended that you make this warehouse archived, rather than leave it to grow grass!
- JSBridge H5调用原生的方法,频繁调用的性能优化
- iOS17.1.1 收不到回调 HOT 8
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from webviewjavascriptbridge.