downloading files to iphone app from apple store - iphone

My application is somehowe a library, represented by a UITableView, each row displays three book icons, pressing on any icon would cause the app to navigate to a scrollview that scrolls between the book pages.
Each book is represented in the resources directory by two things :
1- a .plist file, eg : Book1.plist
2- a folder containing images ( each one corresponds to a book page )
I want to allow the user to buy new books, so if he wants to buy a certain book, what happens is that the new book's "plist file" & "images folder" are downloaded to the application, and then the book is automatically displayed in the UITableView (I have done this last part, which is : adding a new plist file to the app would update the UITableView with a new book icon).
SO how can this downloading thing be achieved ?
I think that the user, when clicking on the "download new book" button, should navigate to apple store webpage which contains the books that should be downloaded right ?
Then buying a book would directly download the "plist file" & "images folder" to the application, but how can this be done ?
Please can anyone offer a detailed help, and thanks in advance

You probably want In-App purchase, with a few caveats:
In-App purchase is entirely in-app. There is no "apple store webpage" (do you mean "App Store"?); you do the UI yourself, and then ask StoreKit to authorize the transaction
The App Store does not store extra content for you. Either you bundle the books with the app (i.e. the "purchase" unlocks content that has already been downloaded), or you use your own server (or Google App Engine, Amazon EC2/S3/CloudFrount/whatever) to serve the content.
EDIT:
The only way to add bundled books is to release an update. This generally involves a 1-2 week delay and is prohibitive if your books are big.
It's entirely trivial to rename .ipa to .zip and unzip to get the resources (the binary is encrypted but the resources aren't), so you might want to add encryption (encryption for DRM-like purposes doesn't require CCATS classificaton/exception/whatever).
Writing a webserver is out of the scope of this answer. An easy way is to just stick static content in a hidden directory on a server somewhere; the "proper" way is to have the app send the App Store transaction receipt to the server, verify it on the server, and deliver the content only if verification passes. I'm not sure if there's open-source code or a proprietary service which lets you do this without writing your own code.

Related

Embeding multiple apps in an app?

I am a newcomer to application development and I'm wondering if the concept I have can actually be created.
My concept involves creating an app that has the ability to embed another app within itself.
I'll do an example which is also a very bad one but you'll at least get the point.
Picture an app on the iphone that's called "Kwesi's app". Once you tap on it, it opens up a page with 3 icons. A facebook icon, a gmail icon and a hotmail icon. Now tap your finger on the gmail icon and instantly your gmail opens up withing "Kwesi's app" and you have full access. There is also a button in the top left corner that says "Main Menu". Once you tap the "Main Menu" icon, you go back to the three icons and can now rinse and repeat.
I hope this example is clear enough.
The question I seem to be coming back to is, would it be possible having an application that embeds or links you to other apps in that manner? I can only guess that it'd be really weird since they'd have to be installed seperately on your phone but I don't want that. I want one app that can handle an already set amount of apps within itself as the above example shows.
Thank you very much for reading and any thought would be very much appreciated.
/Kwesi
No, that is not possible in iOS for security reasons. But you have the following choices to modify your idea:
Register a protocol for the app : This will allow you to send data between applications using protocols. However, if the app wasn't made by you and doesn't have a protocol, then you can't use it.
Using this idea, it is possible to open an application. For example, opening Facebook with "fb://" or evernote with "evernote://". I am sure there are other applications that have these protocols. Just be aware that you don't have control on the application in this case. You can only open it and send data to it.
Since your example was about Facebook, Gmail. Then I would suggest using their corresponding API and build everything in your application. Many famous applications provide APIs for a fee or free usage. You have to check with each one separately.

Need to make a DLC "packet" system for my iOS game

I'm developing a game for iOS and I need to make a system to download "packs" after the player bought them with In App Purchases.
I've search on the internet for a method like using a bundle, or just using web services, but I really don't know which one is the best.
Let me be specific: in one pack the player has between 1-3 sprites, 1-2 music files, and 1-3 backgrounds.
So what I need to do is download that "pack" and store it as "purchased". What methods would be the most reusable and modular?
By far the easiest and most simple solution would be to bundle the DLC in to your app with an update and simply use an in app purchase to unlock them for the user. This saves their time and bandwidth as they no longer have to download the files and it saves you paying for a server to host it all.
There are several ways to go about this. In the past I created a system for a previous client that used a manifest that referenced all the files in the "pack", then downloaded each asset. The manifest could be updated to point to updated/different assets if needed, and contained a version number so that the system would know if it needed to update assets after the user had previously downloaded the pack. I probably wouldn't worry so much with a one-size-fits-all approach on this; just get something up and running for this one project that can be used on all DLC packs. Your next project will probably need heavy modifications for the same system to work.

iPhone app: How to implement in-app purchased game levels

So, I understand that it's possible to set up in-app purchases for iPhone apps to purchase non-consumables like game levels. I understand the logic behind the purchase part, but what I don't understand is, how can I deliver the new game level.
For example: I build an app that contains the first level and they purchase additional levels. Is it better to build all the other levels into the app and whenever they purchase the app, it unlocks it with a plist entry or something? That doesn't seem very update-able to me. Every time I come up with a new level, I'd have to update the app.
So, what I don't understand then, is what is how do I package up a level and download it as a separate entity that can accessed by the game? Would the level just be some XML with images in a ZIP folder or something? How does the level get added to the game? What are best practices for this type of thing?
I Googled and have found NOTHING about this.
I'm a little bit confused by the concept and any help would be appreciated. I'm not looking for someone to write the game for me, I just need pointed in the right direction so I can develop it on my own.
Your game level is whatever you want it to be; you are the designer, after all.
You should look at NSBundle documentation, which can include property lists, image resources (etc) as well as additional code. Package your bundle (zip is convenient), download asynchronously using NSURLConnection, and install be checking the NSDocuments directory for bundles and load with NSBundle.
Or for a simple game level using existing resources, just download a plist that describes it.
You don't need to have your own server; you can download from me.com if you have a MobileMe account, or any similar service.
I would read over the In-App Purchase Programming Guide. It has all the info you need.
In summary: a user will perform the in-app purchase and get a digital receipt from Apple. Your iPhone application should then contact your server to download the new levels, using the receipt as a verification of purchase.
If you don't have a server available to distribute your levels, you might want to consider a third-party service such as UrbanAirship.

how to play the 30 seconds sample itunes music

I'm trying to figure out if its possible for programmers to build an itunes client app for iphone or android where the user has the option to browse and listen to the song preview, something similar to this page: itunes link maker
I greatly appreciate any pointers or links in this direction
thanks
I would imagine your main problem is going to be legal rather than technical. The Apple Website's terms of use say:
Except as expressly provided in these Terms of Use, no part of the Site and no Content may be copied, reproduced, republished, uploaded, posted, publicly displayed, encoded, translated, transmitted or distributed in any way (including “mirroring”) to any other computer, server, Web site or other medium for publication or distribution or for any commercial enterprise, without Apple’s express prior written consent.
I'd be surprised if an iTunes Store Browser application passed Apple's approval process since the iPhone already has one and it's even more unlikely that Apple would let you use their content for an Android application.
Try this.
You'll notice that there is a field called "previewUrl". This gives the url to direct to for the preview of the song. It's not hard to play around with the link to generate content for whatever you're looking for. Make sure you've got an affiliate license first..... May as well make money out of any purchases.

iPhone: Setting up an app for use as an "In App Purchase"

Regarding In App Purchases, I can find a lot of information on all the technicalities of actually making purchases and interacting with the store (how to retrieve product information, verify receipts, etc), but I can't seem to find information on guidelines or special instructions for preparing the actual "apps" or "components," whatever they're to be considered, which will act as the In App Purchases.
For instance, once a component is downloaded into an app, where does it exist in the overall architecture of the app? How do they combine to join forces? How do they know about one another. If I have a game, and using In App Purchases I allow users to both download new levels, but also download new game play modes that can affect any of the built-in or downloaded levels, how do I prepare all of these assets so that they integrate?
I'm not looking for a tutorial, per se, but would love to know if anyone has had experience with In App Purchases or knows of a useful reference besides Apple's In App Purchase programming guide which only speaks to the specifics of making the actual download transaction.
The things you download aren't really "apps", they're just data files like anything else your app can download.
Sometimes, they're not really that, they're just effective "switches", i.e. all of the functionality and data is there in your code already, but it's just protected by a line of code like
if (user has purchased extra levels)
add extra items to menu/list
You aren't allowed to download new executable code; I admit I'm not sure how carefully Apple works to prevent you from downloading scripts that control your program's behavior, since it would be very difficult for them to tell what is intrinsic to your original app or not.
In my own programs, I've put the control logic and tables into the main application, and separated out big resource files into a separate ZIP file. When the user buys the add-on pack, they do download that ZIP file of images which keeps the original application size down, and the program just uses those images out of the documents directory instead of the application bundle like it would if they were built in.
I am using the Urban Airship in-app purchase support, which insulates you from running your own server or learning most details of the StoreKit, at the cost of a slice of your revenue.
You can let the levels be in the app from the beginning and just let them become available when the user pays an in-app level. This is by far the most simple solution.
If you want to have downloadable levels you will need to set up an own server that will deliver and check correct purchase transactions with apples servers. You will also need to create all the download and architecture to load and use these levels into your app.
But, you can have a look here http://urbanairship.com/in-app-purchase/ for help in creating downloadable items.
This code will get you going: works on the simulator too: https://github.com/boxerab/InAppPurchase