Charboost Ad not dispalying in my app - iphone

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.

Related

How to redirect after login in iOS app

I am working on an app and would like to know how to automatically redirect someone to their profile page or a home page after they login into my app?
If relevant I am using the Parse UI to log in and sign up and coding in swift and using Xcode7
Any advice welcomed
PFLoginViewController has a delegate with calls that you can use to indicate when a user has successfully logged in. I believe it gets called when a user signs up as well, but I could be mistaken.
You can use those calls to signal a successful login/signup and then redirect to the appropriate view controller from there. If you want any more advice, you will need to be more specific with your question.
As far as I understand you want to redirect your user to specific view controller if user already logged in ? You can use below code in your app delegate file.
var currentUser = Parse.User.currentUser()
if currentUser != nil {
// Your redirect code
}

Cordova app check if user signed in before closing my app?

i'am trying to made cordova application that need user login to (google + or Facebook)
so i show button for sign in to (google+ or Facebook)
but after i close the app and open it again i need the sign in button hide depending on last signed in account
i need to know how i can check if user signed after closing my application?
ie check if user subscribe with data login to my app or no?
You can check this when your application gets loaded in
function onDeviceReady() {
// Now safe to use device APIs
//Create small function which check for is access toke valid or not
//which returns Boolean true or false
// Else you can use localStorage.isSignInned and once logged in set it as true.
if(isSignInned)
{
//hide buttons
}
}
You can check facebook javascript api here and google javascript api here
It depends upon how you want your application to work.
I am attaching working sample which i created for Facebook for GooglePlus
hope this helps.!

facebook ios sdk isn't working. iphone

I followed all the steps from here http://developers.facebook.com/docs/getting-started/facebook-sdk-for-ios/ (Adding SDK & framework dependencies, Adding SQLite and the -ObjC linker flag, Adding the Facebook App ID), but I can't figure out why I get the error
Use of undeclared identifier 'FBSettings'
when I put
[FBSettings publishInstall:YOUR_APP_ID];
into
(void)applicationDidBecomeActive in AppDelegate.
Ok. I found the solution. I'm seeing the "fb_mobile_activate_app" event show up in the App Dashboard -> Insights -> App Events -> Overview
What I did:
Followed the iOS Getting Started instructions.
Added the deprecated headers, I'm sure there is a better way to do this but it worked for me. Add the headers by dragging the DeprecatedHeaders folder from the FacebookSDK.framework/Versions/A/DeprecatedHeaders folder into the Frameworks section of your Project Navigator. Choose 'Create groups for any added folders' and deselect 'Copy items into destination group's folder (if needed)'. This adds the headers as a reference.
Then I followed the Add the Facebook SDK instructions which was just adding the following code to the AppDeligate.m file right before the '#end' at the bottom of the file. This code should tell Facebook that the app was opened and that the app was installed from an ad click (DON"T FORGET TO CHANGE YOUR_APP_ID WITH YOUR FACEBOOK APP ID):
- (void)applicationDidBecomeActive:(UIApplication *)application {
NSLog(#"Application did become active.");
[FBSettings setDefaultAppID:#"YOUR_APP_ID"];
[FBAppEvents activateApp];
}
Added the this include to the very top of the AppDeligate.m file:
#import "FacebookSDK.h"
That's it. I now have this code in the app store and I'm getting install data for Facebook Ads.
I had the same issue but I just added:
#import <FacebookSDK/FacebookSDK.h>
And that got rid of my error.
See the demo ~/Documents/FacebookSDK/Samples/HelloFacebookSample to see it in action
You also have to import AdSupport.framework and Social.framework.

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

iphone how to capture simple login/logout event from web to native

I am developing iPhone application which loads login page of my website. I am able to load my login page using phonegap/childbrowser. I am newbie to JS, Phonegap.
How do my native/phonegap application should handle logout and login event has performed on the webpage? Please guide me how to know user has logged out.
Also is it possible to add support for Push Notification in phonegap/childbrowser application ? How?
So far have seen facebook login-logout questions around but hard to understand and couldnt simulate similar approach.
does your whole app run using the childbrowser? If so why not just have the login log out as piece of your app?
Also if you have to use the childbrowser best bet is to set up a locationchange event and if the location equals a login success page then append some arguments and store those using localstorage.
example -
client_browser.onLocationChange = function(loc){
locationchange(loc);
};
function locationchange(loc){
if(loc.indexOf("http://www.example.com/success?login=true&user=foo") > -1){
var user = loc.match(/user=(.*)$/)[1]; // grab user info
localStorage.setItem('login','true'); // set login as true
localStorage.setItem('user',user); // set username
}
}
that will save to your app locally that the user is logged in and their username, which you can use later if you need to use the childbrowser by passing that in the url you open and on the server side you'll have to look for those arguments.
to log out just open the childbrowser and send a logout argument
www.example.com/logout?user=foo
and in your localStorage
localStorage.setItem('login','false');
Honestly this is kind of a vague question, it would really help to understand why you're wanting to do this in the childBrowser vs your app...