reading a file saved by another app in iphone - iphone

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.

Related

Is there a path every app can write files in the jailbreak iPhone?

I should hook UIResponder of every app, including SpringBoard and any others. In the hooking, I will write something to the specified file. If I set the path to /var/mobile/Library/MyApp, recommended by Cydia, I found that only the SpringBoard and MyApp could write successfully.
So is there a place every app can write and read?
I admit that I'm not 100% sure on this one, but my guess would be no, there is not a path that every app can writes files to on a jailbroken iPhone.
Certainly, jailbreak apps (installed in /Applications/) on a jailbroken phone can write to locations that can be shared between those jailbreak apps. But, as I understand your question, you would like to inject code into normal, App Store apps, so that those apps can also read and write to the shared location. That part I don't think is possible, because jailbreaking does not completely disable the sandbox for 3rd-party apps installed normally, under /var/mobile/Applications/.
Now, there might be a workaround. There are some shared folders that are accessible to all apps for certain purposes. For example, any app can write images to the saved photos album. What you could try is to take the content of the file you want to write, and encode it as fake image data, in a UIImage (e.g. with [UIImage imageWithData:]). You'd probably need to add a valid image header to the data. Then, you save the file to the photos album, using something like
writeImageToSavedPhotosAlbum:orientation:completionBlock:.
Another app could then find the fake photo by enumerating the saved photos album, and then converting the asset back to image representation to pull the real data back out.
However, this seems quite complicated, and possibly wouldn't work (I haven't tried it). Perhaps you could tell us why you want this shared file. Maybe there's a better way to share the data, without using a globally-accessible file?
Notifications can help you with this. Every app will send interprocess notifications about the events. You could start a daemon that will listen for this notifications and save them in a file. Or you could listen for them in SpringBoard as he can write, for example, to /var/mobile/Media. Depends on what you want to do with this file. Check out my answer here How to create a global environment variable that can be accessed by SpringBoard or other applications in the jailbroken iPhone?

Where from could I download iPhone system sound files

I need to play in my app iPhone system sound files, for example, message sent, message received.
I was expecting to find these sound files available by default in iOS, but it seems not, please, correct me if I'm wrong.
Is there is away to download these default system iPhone sound. I need mainly message sent, message received.
To add to what WrightCS said, Apple makes it very clear that the only media assets (sounds and pictures) you are allowed to use are the ones that they provide explicitly. If you try to use their sounds they will definitely reject your app.
They also don't want you using their media for anything other than the things they intend them for. Their Human Interface people would have whole litters of kittens if they found out somebody was repurposing their carefully chosen UI elements for other uses, and would reject your app with extreme prejudice.
In short, don't do it. It will get you rejected.
To use sounds in your app, you will either need to create these sounds yourself, or purchase sound effects from a number of different websites. Being that your application is sandboxed, you cannot access the SMS send / receive sounds (for example). I also doubt Apple will allow you to "steal" their sounds for use inside your application. Try searching for free sound effects, One Example.
Theses resources should help you get started.
https://github.com/TUNER88/iOSSystemSoundsLibrary
https://developer.apple.com/library/ios/documentation/AudioToolbox/Reference/SystemSoundServicesReference/Reference/reference.html

Is it possible to modify (add a feature to) the iPod application on iPhone?

I love the iPod application on the iPhone, but I wish a had a really simple way of saying "Play this next". Other small additional features could do wonders as well. Is it possible to modify the iPod application or in some way add a feature?
No, you can't. First, Apple doesn't give you access to the source code for the app, which you would need. Also, Apple doesn't provide any api to allow modifications to its apps. You can access data (the songs themselves) so if you really want it to be different, you'll have to write your own app.
It is not possible..Apple only provide you to use data from only few of is own apps..so updating them is out of the question

How to find the application launch and end time in iphone?

I am new to ios development and doing development in ios4.0.1 and xcode 3.2.3. My application should capture other application's launch time and (close) end time. how can we do this? Any help will be appreciated.
Thanks
Pushpa
For apps in the app store, the answer is "You can't". The best way to think of other applications on iOS with respect to yours is: don't. You can't access their data, you can't see if they're running, you can't control them, and you can't change them. Apps are well and truly sand-boxed as a fundamental design decision in the current setup.
About the only thing you can do is trigger their launch with a suitably formatted system URL. If a Wikipedia application has registered the scheme wiki, you might be able to launch and communicate some simple data by having the system load the URL wiki://articleName, but that's the limit. You don't even know what application will be launched, only that one has the wiki handler.
Jail-broken iOS systems are a whole different matter, but I'm assuming you're not working on those.

Is it possible for an app to run in the background and collect data?

I want to make an app that runs in the background so that if a user is reading a web page or PDF file on an iPhone or iPad, he can mark some words, see the meaning of those words, and then have those words stored in the app's database. He can then afterwards look for the words which he has learnt and increase his vocabulary.
Does the iOS 4 API allow that? What are the limitations? Advantages? Disadvantages?
Thanks in advance
No is does not, you can only run voip. audio or navigation apps in the background.
Only one app can run at a time, and installing one app cannot effect any built in app. So no, there is no way to achieve what you are trying for here.
Your best bet is to instruct users to copy the word, open the app, and then you can snag whatever is on the clipboard then.
(Note there are multitasking APIs, but you still cant access anything outside of your app even if you convince the OS to let you run in the background for a little while)