PDA

View Full Version : how to access data in iphone in my application?




chinnu
Oct 29, 2009, 01:07 AM
i'm new to iphone sdk.
how to write an application which accesses contacts and sms messages and pictures etc of iphone and show them in sumulator when iphone is connected to computer(mac).
is it possible?
plz reply me.
thanks in advance.



robbieduncan
Oct 29, 2009, 04:16 AM
This is exactly the same as your question at the end of http://forums.macrumors.com/showthread.php?t=810486

And here, as with there, it makes no sense. The simulator is for testing your code. It has nothing to do with attaching a real device.

chinnu
Oct 29, 2009, 08:18 AM
i'm sorry. i'm not presenting my question it seems.
my intention is,
iphone is connected to mac.
then data is available as a files.
my application running in simulator should read those files display data on simulator.
Q1:when iphone is connected to mac, do we get contacts information file.
is my question clear?
thanks for previous reply robbieduncan u are helping me alot.

robbieduncan
Oct 29, 2009, 08:19 AM
my application running in simulator should read those files display data on simulator.

This is the bit that makes no sense: the simulator has no connection to a real phone: it's a way of letting you test your code on your Mac. Nothing more.

Troglodyte
Oct 29, 2009, 08:44 AM
What you see on the simulator is not what is running on the iphone. If you have no iPhone connected you can still use the simulator to run programs that are compiled for it. The simulator DOES NOT communicate IN ANY WAY with a real iPhone.

chinnu
Oct 31, 2009, 01:03 AM
Thanks Guys for your responses. Is there any other application/DB provided by mac or third party through which I can access the contacts.

I am working on application which needs the data from iphone, It needs to run as emulator or within emulator which contains/accesses the data from iphone.

This would bea workaround for me. so that I can store the data in intermediate repository or application and use the same to get it in my application ? does this make sense ?

Hope this clarifies, my intention.

Thanks a lot guys...

PhoneyDeveloper
Oct 31, 2009, 10:05 AM
Why don't you look at the Address Book Programming Guide for iPhone OS, which is part of Apple's documentation. It should answer your questions regarding accessing contacts.

firewood
Oct 31, 2009, 11:58 AM
If you don't encrypt your iPhone backups, then all the iPhone app DBs are stored, in a munged and segmented format, on your Mac, after any iTunes sync.

Find and copy the files desired from the mobile backup directory into your simulator sandbox directory, un-munge and convert these files into DBs, and then access them as local databases in your simulated app.

non-trivial...

chinnu
Nov 2, 2009, 12:44 AM
Why don't you look at the Address Book Programming Guide for iPhone OS, which is part of Apple's documentation. It should answer your questions regarding accessing contacts.
if i use that api, i can definitely access the contacts of iphone for that my application should run on iphone.
but i want to access contacts of iphone in the application which runs on simualtor.

firewood
Nov 2, 2009, 05:15 AM
You could write a network client server iPhone app.

Have the app check to see if it's running on the device, or on the simulator.

If running on the device, act as a server reading from the abperson db and sending to the net.

If running on the simulator, act as a client reading the info from the net and displaying it on the simulator UI.

dejo
Nov 2, 2009, 09:08 AM
...but i want to access contacts of iphone in the application which runs on simualtor.
I don't think you've yet explained fully enough why you would want an application that is running in the simulator to access the address book of a connected iPhone. What problem are you trying to solve with this proposed solution?

PhoneyDeveloper
Nov 2, 2009, 10:39 AM
The description of this problem is very unclear. Obviously normal users don't have the simulator. Is this for an app to be sold on the app store? Why do you want the app on the Sim to access the contacts on the device? For most users the contacts on their computer and device will be synced so they will be the same. Also, broadcasting information about a user's contacts would be considered an invasion of privacy if they didn't allow it.

To give a direct answer to your question, No, an app running on the Sim doesn't have a simple API that will let it read the contacts on a device, whether the device is connected by USB or not. There's no way to just connect to a device and ask it about its contact list. However, if you were to write an app that runs on the device it could be contacted by another app running on the desktop.

You need to give a clearer explanation of what you want to implement.