I built an app which I can add images and texts, what I would like to do is to pack a data from this app (which I can do that by serializing an object to a file) and send it non-synchronically to another app in another IPhone and open it there (without using the mail nor the internet).
for example if I had MMS on IPhone I could do that by sending the file as MMS and set my app to open files with specific post-fix I choose.
Please help, Thanks.
What do you mean by "without using the internet"? You could use NSNetServices to establish connections between devices, and send whatever you want between them. This relies on the TCP/IP protocol though, but does not use HTTP. So if you mean "without going via HTTP", this should be an alternative:
http://developer.apple.com/library/ios/#documentation/Networking/Conceptual/NSNetServiceProgGuide/Articles/ResolvingServices.html#//apple_ref/doc/uid/20001078-SW1
you use an url scheme for small data, or the new UIDocumentInteractionController
Related
I want to be able in my app to upload files from my computer(windows,mac...) to the iPhone,so i an looking for a source code in objective-c that open server on iPhone,
but my question is, how i implement an upload from my computer to the device?
Edit
I want to upload the file from a computer that is on the same Network like the device,
something like :
the user will open browser and select a file and it will be upload to the device.
i found CocoaHTTPServer but i really didn't understand how to upload a file to the iPhone with this.
you probably want to upload the file to FTP-server, that shouldn't be a problem.
set up a webservice or json on your server to know what changed, or should be downloaded (depends heavily on your business logic of your app) - it could also be a static textfile
now the problem is how the app knows that there is are new files.
option 1: poll server if user presses a button or on every app start, etc.
option 2: send push notification to your iPhone app, if there are new file.
polling the server would be very easy to implement, compared to sending push notification.
EDIT:
alright i read your edited post. hosting a local webserver on an iphone sounds still weird to me.
another possible solution, that could work for you - if you only want to transfer only a few and rather small files:
enable Document Interaction in your app.
this would allow the user to send the file by mail to your iphone and open the document with your app with the "open in..." dialog .
I have an iPhone app that reads barcodes. I want to transfer that data to a program I have written on my PC. Is this possible?
The easiest way to do this is to have a web server which the app transfers the barcode to and the application on the computer grabs it from. You could probably have each user make an account which they log in to on both the phone and the computer.
EDIT: This document: http://developer.apple.com/library/ios/#technotes/tn2152/_index.html describes various methods for transferring data between an iphone and a computer.
This is just a suggestion, haven't tried it myself: You can use the iTunes filesharing feature Apple introduced for iOS. This seems to be a good tutorial on how to use it in your App http://www.raywenderlich.com/1948/how-integrate-itunes-file-sharing-with-your-ios-app
The only thing is that it requires the user to import/export the files to share on their own via iTunes, if you're cool with that it sounds like a good strategy to use built-in features of iOS.
I'm new to iPhone programming. So far I've only written a couple of simple apps just to get the hang of it. In a short time I will have an assignment to write an app that will let iPhone users communicate directly using short messages, and probably they will add a requirement to be able to send files to each other attached to the messages. Of course this sounds a lot like a mail client. For several reasons the client does not want to use mail, if possible, and attaching files would leave SMS messaging out. I've been reading Apple's documentation on local, push and broadcast notifications. Would any of these be the way to go?
Thanks
User bonjour if you are one the same network: http://www.mobileorchard.com/tutorial-networking-and-bonjour-on-iphone/. Otherwise it sounds like you want to use Push. I'd recommend checking out Urban Airship
Is there a way to have an app write a into a file and then have another app read from that file?
I mean writting into the file system of the iPhone.
I want to do this without using an internet connection. So uploading the file and then downloading from the other app is not what i mean.
Thanks!
It appears that there are ways you can, but it won't get approved by Apple if you do.
See http://blogs.oreilly.com/iphone/2008/09/sandbox-think-like-apple.html for more information.
The current sand boxing of applications does not allow this, however it appears that this may be available in future iPhone OS versions. Reference
I'm not sure exactly what circumstances you're in here, but you could register app B as a handler for a particular protocol, and have app A try to open such a link (e.g. appB://yourinfohere). It depends on how much data you want to transfer and many other things, but it might work.
I have gone through following link
http://zachwaugh.com/2009/03/programmatically-retrieving-ip-address-of-iphone/
and I have also tried this one (but this isn't recognized by Apple).
http://appsamuck.com/day4.html
I just want that when user tap on "wifi" button.
Reports stored in documents directory can be accessed by other pc using wifi using the IP that I display on my iPhone application. How is it possible?
In my apps, I use CocoaHTTPServer to get local info into and off of the phone. You run the server and out-of-the-box, it indexes all the files in the documents directory.
To do what you want, you will need to edit the code to return some other kind of data format (xml probably is the easiest) the call this from inside your app to get that data. CocoaHTTPServer easily take POST right out of the box too, so you can post an xml response as well.
After thinking about it, CocoaHTTPServer is best run on the computer side behind the scenes. the iphone can then send info to the computer where handling the code should be easier and you have more options.
I can't point to any specific examples but the way to do this would be the ZeroConf protocol - both the iPhone and PC would have to be on the same network to have this work.