itms-services // action=download-manifest url as local file - iphone

I am trying to utilize:
itms-services // action=download-manifest url as local file, is there any standard way of utilizing plist file via that?

I've seen this done in an app that aided with OTA app updating for developers; what I saw in the source code was that a file:// link was used. If you want to do this, you'd have to know the location of the file in the filesystem. Then, you'd use a standard plist file, but in the url key, you'd put file://location/to/your/ipa/file and it would essentially be the same.
Though, that isn't the best way of doing things, because it is an unknown whether the user has the ipa file on their device or not.

Related

is it possible to download a file in my iphone throuh email

I am working on an application in which i write to an xml file and then send it through email and at the reciever end the receiver recives it in his/her inbox and download the file to the iphone and then open the same app on his phone and browse to this file and by clicking sync button the progra should parse the tags in the xml file.
Everything is cler but i am not sure whether we can download a file to our iphone and browse thru it our app.
Thanks, i appreciate. :)
No, I don't believe you can download a file from mail and pass it to your app to open and read. This would be for security reasons.
I think the only way to achieve this would be to not use an XML file, and instead construct a URL with parameters.
There are a few drawbacks here, though. Depending on how much data you need to pass, the url could get pretty large. You would have to take considerations to make sure that each parameter value is properly URL escaped. And you could have to write code to parse the data in the parameters.
This is how other apps pass data between apps, an example would be the iPhone's Phone app. You can make it call a number by using a tel:// URL.
You can register a URL scheme in your app and use it to pass data around.

Naming a file downloaded from url in iPhone

I would like to save a file downloaded from the internet in iPhone.
Can I use the url as the file name? If not, what transformation should I apply to the url to obtain a valid file name?
I need to find the local copy of the file later using its url.
Edit: Not asking where or how to write a file to disk. The question is limited to getting a valid file name from an url.
Can I use the url as the file name?
You can use just about anything you want for a file name. As long as it's a valid file name for the underlying file system.
If
not, what transformation should I
apply to the url to obtain a valid
file name?
This is unanswerable because there's no way to specify what "valid" means here.
I need to find the local copy of the
file later using its url.
You probably want to save it to your application's Documents directory. There already are plenty of questions relating to saving files on iPhone here on Stack Overflow, and I urge you to read some of them.
For lack of a better method, I'm using a persistent dictionary to map the urls to unique names.

Replace existing XML file within iPhone app

I have an .xml file that is going to be shipped within my app.
This file contains values that are read from it and saved as an array when the app launches.
Each time the app is run, I want to check with the server if there is an internet connection. If so, I want to get the newest version of the .xml file from the server and replace the one that I currently have saved in my app (this way, the next time the user logs in and doesn't have internet access, he/she will be able to use the old (yet most up to date) data).
What is the best way to do this?
Thanks,
The best way to probably do this is to copy the XML file from the app bundle to a location in the app's sandbox, e.g. the Documents folder. Thereafter you can update the XML content as necessary with newer data from the server. The copy is necessary to allow you to write to the file, since you cannot change the content of your app's bundle because it is signed.
Alternatively, if the data is simple enough, you can just save it to user defaults on first launch and change the defaults on subsequent updates
I might skip the XML altogether, unless it contains a baseline of default settings, and just sync user defaults over the Internet. You can't modify files in the bundle, so your only option would be to copy over a "default-settings" XML file to the application's Documents folder to make it editable.

Launch my app using email attachement

I want to bind my app to some file extension so when I receive an email with an attached file with the correct extension, clicking on it will launch my app and pass it the attached file.
Is it possible ? How ?
Thx
--G.
As iPhone applications are not allowed to share files on the file system, what you're looking for is not immediately possible (not with the published APIs that I know of, anyway). You might still have a couple of options though.
Either way you'll have to use a custom URL scheme, which is associated with your app, and paste that into your email. This URL might point to some external location, which your app can download the file from.
Or it might contain the actual file contents if it's fairly small. URLs are 'just text' (some restrictions apply), so you're free to put any data you want to in it, as long as it is URL-encoded.
You still need to get the URL into the email though, which might or might not be as easy as attaching a file.
It's not possible to simply associate a file extension with an application on the iPhone.
You could create a custom URL scheme that would launch your app, but probably that won't help you.
This is actually possible, I'm working on this exact same problem and this great tutorial has really helped me.

How do I make the iTunesArtwork image without an file extension?

Apple seems to say that this image should have no extension. But how is that possible to have a file without an extension? Does this make sense? Or did I get that wrong?
It does make sense. Files are allowed to have no extensions. In fact, the extensions are basically a legacy form of metadata that allows the OS to identify their type without having to look inside for header information. Go ahead and rename a .PNG or .JPG file to have no extension and you should have no problems.
It works fine without an extension. When iTunes loads it out of your bundle (for ad hoc distributed apps), it peeks inside the file to figure out if it's a png or jpg.
Note that when you submit an app to the app store at the iTunesConnect web site, you don't put this image in your app bundle, but upload it separately. It should be a jpg file and must have a .jpg extension or iTunesConnect rejects it.
It's possible for a file to have no extension - just save it from a program that lets you specify "all types". It 'makes sense' insofar as the data is still there, but no instruction set is included for how to interpret the data: If Apple has said don't provide an extension, then don't and it should be fine.