Discussion Forums  >  Plugins, Customizing, Source Code

Replies: 16    Views: 103

Dragon007
Lost but trying
Profile
Posts: 1509
Reg: Dec 17, 2011
London
20,590
03/30/13 05:03 AM (12 years ago)

In App Purchase Plugin, How To?

Apologies for creating this thread again, I was late responding to a previous one on the same subject, I need a solution for my problem, so I have posted again. Basically, I want to allow users to purchase and download audio files, but the BT document that BT developers are using as a guide to set up is for screens and not actual downloads. This was my previous post: https://www.buzztouch.com/forum/thread.php?tid=D978BA71978603139AC6375&command=isSearching&currentPage=1&topicTitle=In%20App%20Purchase&createdBy=&repliedBy=&minViews=-1&maxViews=-1&minReplies=-1&maxReplies=-1&forumCategory= Any help will be appreciated.
 
chris1
Code is Art
Profile
Posts: 3862
Reg: Aug 10, 2012
Austin, TX
50,120
like
03/30/13 05:22 AM (12 years ago)
Definitely possible. I used the plugin to turn off ads in my latest app. When purchase is successful, write it to prefs. Then use that to check if downloads are available. (Just one of several approaches you can take)
 
Dragon007
Lost but trying
Profile
Posts: 1509
Reg: Dec 17, 2011
London
20,590
like
03/30/13 05:27 AM (12 years ago)
Hi Chris so does this mean I can follow the same IAP guide, I think you used to set this up?
 
chris1
Code is Art
Profile
Posts: 3862
Reg: Aug 10, 2012
Austin, TX
50,120
like
03/30/13 06:12 AM (12 years ago)
Yep. Just need to do some small mods to save a value to preferences.
 
Dragon007
Lost but trying
Profile
Posts: 1509
Reg: Dec 17, 2011
London
20,590
like
03/30/13 06:18 AM (12 years ago)
Hi Chris thanks for the advice. I'm not a strong coder, in fact I'm terrible, so is this something you can help me with if I get stuck?
 
chris1
Code is Art
Profile
Posts: 3862
Reg: Aug 10, 2012
Austin, TX
50,120
like
03/30/13 06:21 AM (12 years ago)
Absolutely. Just let me know.
 
Dragon007
Lost but trying
Profile
Posts: 1509
Reg: Dec 17, 2011
London
20,590
like
03/30/13 08:42 AM (12 years ago)
Hi Chris do you know what size my buttons should be?
 
Dragon007
Lost but trying
Profile
Posts: 1509
Reg: Dec 17, 2011
London
20,590
like
03/30/13 09:49 AM (12 years ago)
Hi Chris I have setup my IAP for a product, but now I'm ready to setup the purchase as a download and have no idea what to do next.
 
chris1
Code is Art
Profile
Posts: 3862
Reg: Aug 10, 2012
Austin, TX
50,120
like
03/30/13 11:16 AM (12 years ago)
Okay - so when you complete a purchase using the Easy In-App Purchase plugin, it already writes something to the preferences. It does so like this: NSUserDefaults *defaults = [NSUserDefaults standardUserDefaults]; NSString *key = self.productID; [defaults setObject:@"EasyiAP_YES" forKey:key]; So, you can easily retrieve at any point in your app whether the user has purchased a particular in-app product, like so: //load the preferences: NSUserDefaults *defaults = [NSUserDefaults standardUserDefaults]; //Pull the setting for the in-app product we want to check for //(Be sure to replace "com.domain.appName.productID" with your details): NSString *userDidBuy = [defaults objectForKey:@"com.domain.appName.productID"]; if ([userDidBuy isEqualToString:@"EasyiAP_YES"]) { //some code here }
 
chris1
Code is Art
Profile
Posts: 3862
Reg: Aug 10, 2012
Austin, TX
50,120
like
03/30/13 11:17 AM (12 years ago)
Are you making each individual download a separate in-app purchase? Or is there a 'downloads' screen that you are granting access to? If it's the latter, then you would use my code above to specify whether a link to that screen should be shown from some other screen (menu screen likely).
 
Dragon007
Lost but trying
Profile
Posts: 1509
Reg: Dec 17, 2011
London
20,590
like
03/30/13 12:18 PM (12 years ago)
Sorry just seen the post will start on it now. In answer to your last question yes I will be making individual IAP for each download.
 
Dragon007
Lost but trying
Profile
Posts: 1509
Reg: Dec 17, 2011
London
20,590
like
03/30/13 12:22 PM (12 years ago)
Just read your post about the code; I'm guessing I cannot use this code above as each screen will be an individual IAP. Any further options?
 
Dragon007
Lost but trying
Profile
Posts: 1509
Reg: Dec 17, 2011
London
20,590
like
03/30/13 01:02 PM (12 years ago)
Hi Chris do you think if I were to use Apple to host the content that it will make things easier to setup at the BT end?
 
Dragon007
Lost but trying
Profile
Posts: 1509
Reg: Dec 17, 2011
London
20,590
like
03/30/13 01:31 PM (12 years ago)
Hi Chris been thinking; could I create a html doc or use the Custom URL plugins as the download page once a user purchases the audio and it redirects you to approved purchase screen? Does that make sense? Do you think that would work?
 
chris1
Code is Art
Profile
Posts: 3862
Reg: Aug 10, 2012
Austin, TX
50,120
like
03/30/13 02:39 PM (12 years ago)
Yeah - I would create a menu of "links" that each point to an instance of the in-app purchase plugin. Each of those should point to a screen with the download (custom URL would work, as would a host of other approaches) That way, you shouldn't have to mess with code
 
Dragon007
Lost but trying
Profile
Posts: 1509
Reg: Dec 17, 2011
London
20,590
like
03/30/13 03:24 PM (12 years ago)
Hi Chris I tried adding a custom url page with a link to download but it didn't work, or should I say that nothing downloaded, the page just has a loading symbol but nothing happens. Again a bit stuck, not sure what next.
 
Dragon007
Lost but trying
Profile
Posts: 1509
Reg: Dec 17, 2011
London
20,590
like
03/30/13 03:54 PM (12 years ago)
Ok, found this post online to allow downloading of audio files onto an iPhone. Problem is I have no idea what to do with the code. http://stackoverflow.com/questions/13315418/how-to-download-audio-files-from-a-server-into-my-iphone-application Does anyone?
 

Login + Screen Name Required to Post

pointerLogin to participate so you can start earning points. Once you're logged in (and have a screen name entered in your profile), you can subscribe to topics, follow users, and start learning how to make apps like the pros.