开发者

Using ASIHTTPRequest to download a file with Cocoa/MacRuby

开发者 https://www.devze.com 2022-12-28 17:45 出处:网络
I\'m still trying to get a hand开发者_JAVA百科le on Cocoa (both in Obj-C and MacRuby), and I\'d really appreciate seeing how to download a file with ASIHTTPRequest (or without it) and MacRuby. Ideally

I'm still trying to get a hand开发者_JAVA百科le on Cocoa (both in Obj-C and MacRuby), and I'd really appreciate seeing how to download a file with ASIHTTPRequest (or without it) and MacRuby. Ideally, I'd like to be able show the progress inside a progress bar too.

Must use a cocoa method for downloading, since open-uri in MacRuby is borken.

Thanks for your help.


Here is an example app doing exactly that using HotCocoa: http://github.com/richkilmer/hotcocoa/tree/master/examples/download_and_progress_indicator

You would have to convert it to normal Cocoa but if you look at http://github.com/richkilmer/hotcocoa/blob/master/examples/download_and_progress_indicator/lib/application.rb you will see the main callbacks defined.

You might want to ask your questions in the MacRuby mailing so people involved with the project can help.

  • Matt

p.s: The cocoa IO methods are way more stable and efficient than Ruby's. Also keep in mind that you want to do async calls, something net/http won't help you with.


Here are more explanations and an example from the book I'm writting: http://macruby.labs.oreilly.com/ch03.html#_urls_requests_connections Hopefully that will help.

0

精彩评论

暂无评论...
验证码 换一张
取 消