Auggnet
Veteran developer
Profile
Posts: 225
Reg: Nov 20, 2012
USA
2,550
05/23/13 11:19 AM (12 years ago)

[chris1] [Absentia] IAd & IAP with EIAP Plugin

Would it be possible to remove the button hard coded into the home screen and add a button from the bt cpanel linking to the specific IAP called lets say “Remove ads”? This way if I need to reference it to someone anywhere else in the app have them go to the IAP page, have the EIAP Plugin check if the title nav bar says “Remove ads” or whatever it is and make sure the user has successfully completed the purchase and then set the bool value for no ads to true, then use the code that checks for the bool value before my ad code displays? Basically: - The user is directed to the IAP from a button or menu. - EIAP is modded to check the title of the nav bar for "Remove Ads" - If it checks out it will make sure the user has purchased successfully - If the user finished purchace then it will change the noAds var to true - Then when the user opens a screen plugin with ad code in it - The plugin will check the bool before displaying the ad - If noAd bool is true dont display, or if it is false display ads. Also note that my ad code is only in the custom html plugin, i am fine with that code its a simple boolean check that is understandable and working for me, i can even add it to other screens if i need to in the future. What i need help with is the code in the EIAP gotopurchase method. Also i dont want to hard code a button into a plugin... i just want the code to be modded in the EIAP plugin thanks! This would be very helpful also I have some issues with your original setup in the EIAP Mod you had made. It is giving warnings when it gets the navtitletext, saying that type is not found in the return type which defaults to the type ID
 
chris1
Code is Art
Profile
Posts: 3862
Reg: Aug 10, 2012
Austin, TX
50,120
like
05/23/13 11:27 AM (12 years ago)
A couple of things: "Would it be possible to remove the button hard coded into the home screen and add a button from the bt cpanel" --- Not sure I understand what you mean here. What plugin are you using for your home screen that has a button hard-coded into it? You should easily be able to point to a screen made with the EIAP from anywhere using the control panel. In terms of saving a BOOL value to tell a plugin whether or not the IAP has been purchased for the purpose of removing ads, you'll need to add code into both the EIAP plugin (to save the BOOL value) and in the plugin that displays the ads (to check if it's true). But in addition, you'll need to write/read this BOOL to the NSUserDefaults, so that it persists across the app and when the app closes, etc.
 
Auggnet
Veteran developer
Profile
Posts: 225
Reg: Nov 20, 2012
USA
2,550
like
05/23/13 02:20 PM (12 years ago)
Ok i figured most of it out! I simply added [[NSUserDefaults standardUserDefaults] setBool:YES forKey:@"noAds"]; [[NSUserDefaults standardUserDefaults] synchronize]; into the gotopurchase method under purchasePageFlag = YES; Everything works, but the only issue is that ANY in app purchase will make it disable ads. i want to make an if statement to check the screen id or title text of that EIAP screen, if it is the correct name of the screen such as "Remove Ads" As i have it, than it will run the code above to change the boolean value. Thankyou!
 
chris1
Code is Art
Profile
Posts: 3862
Reg: Aug 10, 2012
Austin, TX
50,120
like
05/23/13 02:54 PM (12 years ago)
I would check against a JSON value. Could check the navBarTitleText JSON value or could modify the plugin to add a new JSON property.
 
Auggnet
Veteran developer
Profile
Posts: 225
Reg: Nov 20, 2012
USA
2,550
like
05/23/13 03:02 PM (12 years ago)
I get a breakpoint and the run pauses or freezes on the if statement that @Absentia did if([[BT_strings getStyleValueForScreen:self.screenData nameOfProperty:@"navBarTitleText" defaultValue:@""] isEqualToString:@"Remove Ads"])
 
Absentia
buzztouch Evangelist
Profile
Posts: 960
Reg: Oct 20, 2011
Alaska
20,600
like
05/24/13 11:54 AM (12 years ago)
Hey Auggnet That line of code should work - what exactly do you mean by "I get a breakpoint"? Breakpoints only appear when you intentionally create them...it's sort of like telling your app "stop when you get here". Is there a blue arrow next to that line of code? If there is, simply right click and delete it..you probably accidentally added it in there without noticing
 
chris1
Code is Art
Profile
Posts: 3862
Reg: Aug 10, 2012
Austin, TX
50,120
like
05/24/13 12:01 PM (12 years ago)
Unless he followed my guide to break on all errors. Still, I see nothing wrong with that code either.
 
Auggnet
Veteran developer
Profile
Posts: 225
Reg: Nov 20, 2012
USA
2,550
like
05/24/13 01:17 PM (12 years ago)
Have you run the code? The syntax is correct and it follows the return type but it crashes when the go to purchase screen is called and freezes and pauses the run.
 
chris1
Code is Art
Profile
Posts: 3862
Reg: Aug 10, 2012
Austin, TX
50,120
like
05/24/13 01:35 PM (12 years ago)
Can u post a screenshot?
 
Auggnet
Veteran developer
Profile
Posts: 225
Reg: Nov 20, 2012
USA
2,550
like
06/04/13 10:34 AM (12 years ago)
Well it has been some time i just decided to add the boolean to true when they purchase any iap screen... i only have one iap for now but if i want to make multiple i will come back to this thread thanks!
 
chris1
Code is Art
Profile
Posts: 3862
Reg: Aug 10, 2012
Austin, TX
50,120
like
06/04/13 01:13 PM (12 years ago)
Glad you found a solution that works for you!
 

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.