Remove ad banner after completing in-app purchase within iPhone app - iphone

How is it possible to remove chartboost banner after in-App purchase ?

use something like this
set bool key isPurchase YES in your NSUserDefaults when you purchase App
if(![userDefaults boolForKey:#"isPurchase"])
{
NSLog(#"Enter add start ");
[[Chartboost sharedChartboost] showInterstitial];
}
[userDefaults synchronize];
}

The easiest way is to save the information in user Defaults as mentioned in above post but this won't be secure because user defaults can easily be accessed by many softwares and one can edit/add your Key unless it is kind of big one and secret OR no body post it as a Hack.
The best thing is to store this information at Server (if you have it) or store this information in Key Chain because it is secured.
How to do that easily with keychain follow below post
iOS: How to store username/password within an app?

Chartboost offers a delegate method -(BOOL) shouldDisplayInterstitial:(NSString*)location
Returning "false" in this method will prevent an ad from showing; remember to return "true" if you do want an ad to show. Just compare against a boolean stored locally to track if they bought the IAP or not.
The reason recommend this method rather than hardcoding is because you might want to leave a few locations specific for cross-promotion campaigns promoting your own apps that will still be able to show ads in the future.
This way when you release a new app you can run a limited promotion and make sure that your most loyal fans who bought the no-ads IAP can still see a cross-promo ad for your new game - a great way to funnel your highest quality users to your new app! If you make the ad art right, they won't even know it's an advertisement and you can make it so they only see it once.
Then you can add showInterstitial:#"cross-promo" wherever you might want to show this and disable all publishing campaigns just for that location. Then, in the future when you have a new app, add a new cross-promotion campaign in that location promoting your new app and EVERYONE will see it - even the people who bought IAP!
an example of this implementation:
-(BOOL) shouldDisplayInterstitial:(NSString*) location {
if(_userBoughtNoAdsIAP && location != #"cross_promo"){
return FALSE;
}
return TRUE;
}
And don't forget to set the [Chartboost sharedChartboost].delegate = self; to make sure the delegate methods function properly!
Full Disclosure: I work for Chartboost

Related

Charboost Ad not dispalying in my app

I am integrating chart boost Ad into my iOS app. But it is not displaying any Ad.
I used the following code in 'applicationDidBecomeActive' method, to display the chart boost.
Chartboost *cb = [Chartboost sharedChartboost];
cb.appId = "YOUR_CHARTBOOST_APP_ID";
cb.appSignature = "YOUR_CHARTBOOST_APP_SIGNATURE";
// Begin a user session
[cb startSession];
// Show an interstitial
[cb showInterstitial];
What is the problem with this? Is there anything else that I have to do?
Thanking You in Advance
You can refer following links:-
https://help.chartboost.com/downloads/ios
https://github.com/ChartBoost/client-examples
The second link contains example code too, so you can refer that, and your code just need to be written in appdelegate file with proper chartboost_id and chartboost_secret. [cb showInterstitial] should be in the controller you want to display ads.
Is it giving you any error message ? You don't want to show us your appId and appSignature or you are assigning the same appId and appSignature.
If you have not created them yet please go through this link
1.Create an account.
2.Choose Apps tab then Add App
3.Fill all fields.
After that use that appId and appSignature in your code. You will able to show Interstitial popup.
If you want to show More Apps list too then you will have to add a Campaigns.
Select Campaigns tab then add Campaigns > Publish in Network and fill the detail. After that edit your app choose More App Page fill the added Campaigns name in that device and click on save. Now you can use [[Chartboost sharedChartboost] showMoreApps]; method too.
Note: If you are testing it on simulator and app is not live your Chartboost's app's test mode should be enabled.

Chartboost in iphone project / Chartboost usage in iOS

Integrated chartoost sdk in to iPhone game. (Landscape game)
#define CHARTBOOST_ID #"55c9f216f6cd4572f3975566"
#define CHARTBOOST_SIG #"9cc8122cfb05bfe0e171f46990180147e8b6f23c"
[Chartboost startWithAppId:CHARTBOOST_ID appSignature:CHARTBOOST_SIG delegate:self];
[Chartboost showInterstitial:CBLocationHomeScreen];
But it is not displaying any ads. Help me to find what's wrong with settings in Xcode or account in chart boost.
Notes_Warning :
Hi All, don't use Chartboost, instead try google Admob or other ads network. Because Chartboost - a cheater! I used Chartboost in my games, game got good ranking in Cambodia - reached #1 in Racing/games. Game got good downloads too...But Chartboost said we used many device in Cambodia and downloaded game...its not true...we are not from Cambodia...I tried to send message to Chartboost many times...but they didn't respond and suspended my account. They even didn't pay my 7463$. Really its a heart attack for us. Now we removed Chartboost and used Admob and earned our development cost from Admob easily. So avoid Chartboost avoid getting cheated!!! Truth always wins...Always do good.
Be a good person but don't try to prove it. Just go away from bad cheaters!!!!
Notes_Warning :
Hi All, don't use Chartboost, instead try google Admob or other ads network. Because Chartboost - a cheater! I used Chartboost in my games, game got good ranking in Cambodia - reached #1 in Racing/games. Game got good downloads too...But Chartboost said we used many device in Cambodia and downloaded game...its not true...we are not from Cambodia...I tried to send message to Chartboost many times...but they didn't respond and suspended my account. They even didn't pay my 7463$. Really its a heart attack for us. Now we removed Chartboost and used Admob and earned our development cost from Admob easily. So avoid Chartboost avoid getting cheated!!! Truth always wins...Always do good. Be a good person but don't try to prove it. Just go away from bad cheaters!!!!
Now its working fine. We need to add publishing campaign in our chartboost account. Here
UPDATES:
[Chartboost startWithAppId:CHARTBOOST_APP_ID appSignature:CHARTBOOST_APP_SIGNATURE delegate:self];
[Chartboost showInterstitial:CBLocationHomeScreen];
Some other way to see test Ads:
Add your device UDID in publishing campaign
Enable test mode in App settings.
Perhaps there has been an error in loading them. I would implement the delegate methods as described in the docs, particularly the didFail method:
// Called before requesting an interstitial from the back-end
- (BOOL)shouldRequestInterstitial:(NSString *)location;
// Called when an interstitial has been received, before it is presented on screen
// Return NO if showing an interstitial is currently inappropriate, for example if the user has entered the main game mode
- (BOOL)shouldDisplayInterstitial:(NSString *)location;
// Called when the user dismisses the interstitial
- (void)didDismissInterstitial:(NSString *)location;
// Same as above, but only called when dismissed for a close
- (void)didCloseInterstitial:(NSString *)location;
// Same as above, but only called when dismissed for a click
- (void)didClickInterstitial:(NSString *)location;
// Called when an interstitial has failed to come back from the server
// This may be due to network connection or that no interstitial is available for that user
- (void)didFailToLoadInterstitial:(NSString *)location;
It may also be because the Campaign is not filling adverts and you have not added the devices as test devices to force the adverts to be filled.
This is easily missed since at first adverts may be filled - only during testing they'll just stop mysteriously.
There is a setting in Chartboost:
Edit the Campaign you are using for testing
Under "Campaign Logic" click the "Show Test Devices" button.
Click "Add Test Device" to add each device.
Enable each device and Save the Campaign.
(Don't forget to un-tick them when live - since I assume that missing that will mean those devices keep seeing adverts but you probably want to see how the app really behaves)
You need to set
cb.delegate = self;

Non consumable in-app purchse using MKstorekit4?

I have an Iphone application in which i am using two types of purchases.Non consumable products and a subscription.For subscription i have to use mkstorekit4 anyway.So i need to implement the nonconsumable also in the storekit4.Anybody knows the steps to integrate nonconsumable products with mkstorekit4.Can anybody help me.
As form me,if you've already managed how to add auto renew in your app, you are a guru of in-app,so adding a non-consumble would as easy as a pie,even without a MkStoreKit.
You just make a purchase and save it to UserDefaults.
And with MK you just add it to non-consumable part of your MK plist and add a couple of lines of code-and it's done)
Just a button,that makes a purchase,i think)
Update
This article just confirms, what i told.
http://blog.mugunthkumar.com/coding/using-mkstorekit-in-your-apps/
Configuring for Non consumables :
Non-consumables need no extra configuration. Just enter the list of product ids in the plist file.
For checking whether the user has purchased the feature, you can call a function like,
if([MKStoreManager isFeaturePurchased:kFeatureID]) { //unlock it }
To purchase a feature, just call
[[MKStoreManager sharedManager] buyFeature:kFeatureAId onComplete:^(NSString* purchasedFeature) { NSLog(#"Purchased: %#", purchasedFeature); } onCancelled:^ { NSLog(#"User Cancelled Transaction"); }];

MKStoreKit not storing purchased Products

I'm using MKStoreKit to implement an IAP into my application. Everything does as expected when purchasing the product, no error messages at all. The product is purchased using the following code..
[[MKStoreManager sharedManager] buyFeature:#"pro_upgrade"
onComplete:^(NSString* purchasedFeature)
{
NSLog(#"Purchased: %#", purchasedFeature);
// provide your product to the user here.
// if it's a subscription, allow user to use now.
// remembering this purchase is taken care of by MKStoreKit.
}
onCancelled:^
{
// User cancels the transaction, you can log this using any analytics software like Flurry.
}];
After the product has been purchased I recieve the notification (via the code below) which confirms the purchase..
[[NSNotificationCenter defaultCenter] addObserver:self
selector:#selector (subscriptionPurchased:)
name: kSubscriptionsPurchasedNotification
object:nil];
After the purchase I execute the following code (as documented) to determine if the product has been purchased..
if([MKStoreManager isFeaturePurchased:#"pro_upgrade"]) {
NSLog(#"This feature is purchased.");
} else {
NSLog(#"This feature is not purchased");
}
It constantly returns NO for the product ID. This happens when running the app in the same instance as when the product was purchased as well as closing the app and opening it. Running the app using Development or Distribution certificates make no difference at all. Further more I can't find where exactly MKStoreKit stores the product purchased BOOL that it seems to be looking for (it's pretty deep in the code so i'm not saying it does or doesn't, i just can't find it). My app is storing other information using NSUserDefaults so that isn't the issue.
Any help you can offer will be extremely appreciated, thanks for your time.
MKStoreKit doesn't store in NSUserDefaults.
I use keychain instead. Place a breakpoint in the method
storeData:forKey: (writing this method name straight from my head
without looking at code, search for similarly named methods) and try
debugging it. This is the place I save your purchases.
Do remember that purchases are remembered even after deleting and
reinstalling the app.

is admin on facebook pages

I looked around and could not find anything to do this (well it was not obvious or semi-obvious)
So say i have a facebook application that offers a service that people will pay for during use. The average user can come on and "Subscribe" to it, while the admin of those pages can perform an activity that will cost them money (make me money).
I do not want hacking attempts or anything to hurt our product. So, how can i verify that someone is an admin using the PHP SDK.
What we are currently doing is storing the $_POST["signed_request"] in $_SESSION's data and working with that. Either the $_POST or $_SESSION is not safe 100% (firesheep).
Is there any way to verify this? graph api?
Okay, first things first. To retrieve the signed_request and check if the user is an admin you would use something like:
$signed_request = $facebook->getSignedRequest();
if ($signed_request['page']) { // Loaded in a page tab
if ($signed_request['page']['admin']) {
// Current user is admin
} else {
// Normal user
}
} else { // Canvas view
}
Now I'm not sure what do you mean by:
What we are currently doing is storing the $_POST["signed_request"] in
$_SESSION's data and working with that.
Because if you are using the PHP-SDK then you don't need to worry about storing the signed_request in the session since the SDK will handle it for you.
Now for the last part:
Either the $_POST or $_SESSION is not safe 100% (firesheep).
That's not true, the signed_request is useless without your app secret key to decode it. So even if someone was able to obtain it, it won't compromise your application. Read more about signed_requests here.