Giter Site home page Giter Site logo

Comments (8)

marcuswestin avatar marcuswestin commented on June 17, 2024

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.

leomcg18 avatar leomcg18 commented on June 17, 2024

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.

marcuswestin avatar marcuswestin commented on June 17, 2024

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:

#8 (comment)

My code http://github.com/marcuswestin
My latest http://twitter.com/marcuswestin

from webviewjavascriptbridge.

seppo0010 avatar seppo0010 commented on June 17, 2024

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.

marcuswestin avatar marcuswestin commented on June 17, 2024

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.

marcuswestin avatar marcuswestin commented on June 17, 2024

I'm going to close this as it's not really an issue with the bridge. Cheers!

from webviewjavascriptbridge.

marcuswestin avatar marcuswestin commented on June 17, 2024

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.

leomcg18 avatar leomcg18 commented on June 17, 2024

Thanks Marcus, I'll take a look.

from webviewjavascriptbridge.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.