HTTPRequest and save the file locally into iPad/iPhone - iphone

how do i do a HTTPRequest and then save the File locally into the iPad/iPhone.
Im working with the simulator right now so is it possible to emulate the local data storage?

Yep, this is really easy to do, and I wrote another answer on how to do it: How to download files directly to disk on the iPhone os?

ASIHTTPRequest might also come in handy here as an intelligent wrapper to HTTP functionality:
http://allseeing-i.com/ASIHTTPRequest/

Related

Stream screen from Mac to iPhone

I want to create a program that stream the screen of my Mac to my iPhone. Kind of like it is done in Liveview. I'm still relatively new to Objective-C, so I don't know where to start to make such an application.
It seems you have to have something installed both on your Mac and on your iPhone, but how would you actually stream the screen of your Mac to your iPhone?
Hope someone can point me in the right direction.
Update of question
Thanks for the answers. Still seems a bit vague to me and I'm not sure I really need full video streaming. Implementing also seems to be a pain, since there aren't any real good resources for it.
Taking a screenshot every second or so and streaming it to my iPhone as an image, would actually be ok. I've figured out how to stream an image with Bonjour from my Mac to my iPhone.
The screenshot I need to send to my iPhone is of the design that I'm currently working on in photoshop. I've figured out how to take a screenshot and how to get a list of all open windows. But how to make a snapshot of an open PSD-file, I don't know.
Any suggestions on that?
It's a very big subject, so not really something that can be tackled with a simple response. However, I would suggest that one approach would be to write a VNC client for the iPhone. Indeed, this open source exists that's probably worth a look:
http://code.google.com/p/vnsea/
Tim
I would go with the frequent screenshot approach. You would prepare a screenshot of the item you want to transmit and then use some easy library like my DTBonjour to transmit these objects via WiFi to iOS clients.
https://www.cocoanetics.com/2012/11/and-bonjour-to-you-too/
If you were using layer-backing then you could also use the renderLayer... methods which would also include sub-layers.
The most fidelity you'd get from encoding the individual screen shots in a streaming video format, though this is way more work.
This is called RFB (or RDP), and most remote-screen applications use RFB/RDP protocol and libraries which implement it.

iPhone/iPad HTTP streaming library or server

Is there any available open-source (preferred) or commercial library for on-fly segmenting and streaming of video to iPhone / iPad?
Also, is there any open-source/commercial server (alternative to Wowza) which supports this?
Apple offers mediastreamsegmenter:
https://developer.apple.com/library/content/documentation/NetworkingInternet/Conceptual/StreamingMediaGuide/UsingHTTPLiveStreaming/UsingHTTPLiveStreaming.html
You might also want to peek at Best Practices for Creating and Deploying HTTP Live Streaming Media for the iPhone and iPad:
https://developer.apple.com/library/content/technotes/tn2224/_index.html
There's also Darwin Streaming Server, but you may not need it.
Your first preoccupation should be to try to peek a good segmenter (video speaking): Apple's one is fine.
Then, if you wan't in-memory segmenting, mount the input source folder to a RAMdisk...
Take a look at following link;
http://developer.apple.com/library/ios/#samplecode/MoviePlayer_iPhone/Introduction/Intro.html
This example will show how to play videos from a network based URL.
For more details about playing videos;
You can check red5(java & opensource).
Check lastest beta, or code in svn (as lot hav changed since last officeial release).
It may or may not be able to do that out-of-the-box, if not you can code your red5 app and/or check others people code built arround red5...

getting data from server and store in the iPhone

i want to develop an iPhone app where the app downloads data (say audio clips) from a specified server and stores it locally on the device.
then the app should use the data stored in the device rather than stream it from the server.
could anybody give me the guidelines as to how this can be done? tutorials and samples also appreciated. Thanks :)
The easiest way to play files from the internet is to use -[AVAudioPlayer initWithContentsOfURL:error:]. If you want to make sure that the whole file is downloaded, I think your best bet would be to download the file using NSURLConnection (see the URL Loading Guide) and then using -[AVAudioPlayer initWithData:error:].
Look into ASIHTTPRequest, you will find it much easier to fetch large chunks of binary over the web asynchronously than if you try to code everything yourself.

iphone: coding a data compression or zipping agent?

I'm creating a simple service for uploading photographs from an iphone to a web server.
However, before the requests is sent, I want the app to compress the pictures (custom format or otherwise) in the background before sending it.
Any pointers on how I could go about doing this?
Check out the NSDataCategory posted to CocoaDev. It does exactly what you're looking to do.
http://www.cocoadev.com/index.pl?NSDataCategory
I use ziparchive to unzip content downloaded from a server. It also has functionality to create zip files on an iOS device and might be what you are looking for.
http://code.google.com/p/ziparchive/

Compress Document folder in application sandbox of iphone

I need to compress the Documents folder in the application sandbox and upload the compressed file to a server. I've been able to send files from iphone to the server, but am stuck in regards to compressing the folder. I'm using the ASIHTTPRequest libraries for connecting to the server.
Any body can point me to the right direction. I'd be highly grateful.
Thanks in advance
Nik
You can't alter the Documents folder itself because you don't have permission. However, you can compress files inside it. I pretty sure you can use the command line zlib to do the actual compression. Use NSTask to run it from the apps code.