Adding Aviary In-App Purchases iOS - iphone

So I have tried to add Aviary's IAP purchases and have had little luck getting them to show up in my application. I have not made sure that following has happening
My Provisioning Profile being used to build the application has IAP's turned on
I have uploaded all of Aviary's IAP's to itunes connect
I have added the required code for IAP's in my app delegate:
[[AFPhotoEditorController inAppPurchaseManager] startObservingTransactions];
[AFPhotoEditorCustomization enableInAppPurchases:#YES];
Before I start my photo editor session I add the following code
AFPhotoEditorController* photoEditor = [[AFPhotoEditorController alloc] initWithImage:imgToBeEdited];
[AFPhotoEditorCustomization enableInAppPurchases:#YES];
mPhotoEditorSession = [photoEditor session];
editorController = photoEditor;
[photoEditor setDelegate:self];
They are not showing up at all and I am uncertain of what Aviary is taking care of and what I should be taking care of
I think it might have to do with this line in the documentation:
Add the following lines to your app delegate's -applicationFinishedLaunchingWithOptions: method before invoking any StoreKit framework methods:
[[AFPhotoEditorController inAppPurchaseManager] startObservingTransactions];
This line adds the in-app purchase manager singleton as an observer of the StoreKit payment queue returned by [SKPaymentQueue defaultQueue], and sets a flag enabling in-app purchase code throughout the SDK.
Has anyone added this to their application and let me know what Storekit methods I need to invoke? Any sample code is helpful.
thanks in advance!

Related

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

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

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;

Disabling automatic message box on ShareKit on IOS

we trying to disable the automatic message box when we authenticate twitter on an Ios App. We click connect, once it's authenticated, it opens up a message box. We just want to connect, thats it without the box. Anyone came across this?
It is simple, just do not share, only authorize:
SHKTwitter *twSharer = [[SHKTwitter alloc] init];
[twSharer authorize];
[twSharer release];
If you wish to get authorised user info (in the form of dictionary in NSUserDefaults), such as username run
[SHKTwitter getUserInfo];
for more info see ShareKit 2.0 FAQ
Mentioned behaviour is corresponding with pre iOS 5 implementation. If you use iOS 5 everything is handled by native iOS Twitter framework

iPhone: Cannot test InAppPurchase in sandbox after it is approved

I have a free iPhone App which uses in app purchase. I tested my first InAppPurchase with sandbox environment and it worked fine. After the InAppPurchase was approved and worked fine in App store, I added several new InAppPurchases in iTunes Connect and tried to test them in the sandbox environment. However I could not find these new InAppPurchases in my app.
The following is the code I uses to get InAppPurchase products:
//....
SKProductsRequest *prodRequest= [[SKProductsRequest alloc] initWithProductIdentifiers:
[NSSet setWithObject: prod]];
prodRequest.delegate = self;
[prodRequest start];
//....
- (void)productsRequest:(SKProductsRequest *)request didReceiveResponse:(SKProductsResponse *)response {
int count = [response.products count];
NSLog(#"number of products:%d",count);
for (int i=0; i < count; i++) {
SKProduct* product = [response.products objectAtIndex:i];
NSLog(#"product %d:id=%# title=%# desc=%# price=%#", i, product.productIdentifier, product.localizedTitle,
product.localizedDescription,
product.price);
}
}
If I use the old InAppPurchase product id I can get it, but if I use any newly created product id I got count==0.
From what I saw, I guess may app may not be running in the sandbox environment after my first InAppPurchase was approved, but this is just a guess, because I don't know how to check if my app is in sandbox mode or not.
I searched Internet about this issue and tried the following:
1. created a new version of my app, uploaded it to iTunes connect, and rejected the binary. no use
2. deleted all my provisioning profiles and created new ones. no use
3. created an app id for my app in developer provisioning portal and created provisioning profile for that id and used it in Xcode. no use
My Xcode version was 3.2.5. I upgraded it to 4 but this did not fix the problem.
I am wondering if any one else has seen this issue and found a solution. Thanks.
OK I came across this post and got some hint:
Product Identifiers Are Valid On One Phone But Not Another
I just deleted the app from my iPod Touch, did not reboot, then tried to run my app from Xcode again, and it worked. I guess there was some states saved together with the app which determines whether to use sandbox environment for InAppPurchase or not. Although I could run my newly compiled binary without deleting the old app, I could not get rid of some old state which caused the app not running in the sandbox environment. That is what caused the problem. The solution is to delete the old app from the device before running newly compiled binary.

In App Purchase - can get product info but can't connect to itunes for purchase

I'm trying to make "In App Purchase " works in my iphone app.
I created some products and a few test accounts in itunes connect.
I have no problem to retreive the products data (prices etc..) but when I try to make a payment
- I am asked to log in
- I use a test account
-> the transaction always fail with the following error :
failedTransaction with error : Error Domain=SKErrorDomain Code=2 "Connexion à l’iTunes Store impossible" UserInfo=0x65d02a0 {NSLocalizedDescription=Connexion à l’iTunes Store impossible}
I tried with several products and test account (even in other stores like us) but I still get the same error...
NB : I think it worked fine the first time I tried but never still
Any idea will be welcome !
Thanks
For me, I just scoured my code until I found my mistake. I was so certain everything was fine, but it was not. When I requested product information from the store, I used the correct Product Identifier:
self.productRequest= [[[SKProductsRequest alloc] initWithProductIdentifiers: [NSSet setWithObject: #"com.popculturesoft.RC_vCar.fullVersion"]] autorelease];
However, when I went to create the payment, I used the incorrect Product Identifier:
SKPayment *payment = [SKPayment paymentWithProductIdentifier:#"com.popculturesoft.RC_vCar_Lite.fullVerson"];
Using the product Identifier for the payment is not the correct way to do it, although it allows you to do it. It is better to use an SKProduct object. (I had set the fullProduct property earlier in the code:
SKPayment *payment = [SKPayment paymentWithProduct:self.fullProduct];
I was absolutely certain that the store was down, and that was the problem. But the next day I decided to start from the beginning of the process, as described in http://developer.apple.com/library/ios/#technotes/tn2259/_index.html. This is when I found that my incorrect Product Identifier was the problem.
Check out this thread. It seems to be a problem with the Sandbox. Lot's of people having this issue-
iPhone storekit sandbox stopped working
I had the same symptoms and in my case the problem was that I had a test user account with the same name as a real Apple ID account. I resolved the problem by creating a different test user account.