How to programmatically check whether Mobclix advertisement is running or not? - iphone

I have used the MobClix for ad in my app. Now I want to check whether the advertisement is there or not, programmatically, so that i can put hard coded image instead the ad.
How can I check it?

Use the MobClix built in house-ads feature (your own ads) when they have no ad to show.
EDIT:
Checking the docs I can see that there is didFailLoadWithError method:
-(void)adView:(MobclixAdView*)adView didFailLoadWithError:(NSError*)error
There's also some errors you can check for:
kMCAdsUnknownError
kMCAdsUnavailable
kMCAdsDisabled
I guess therefore that you could wait for an ad request to fail and then show your image.
Problem is, the fail might only be temporary, but you wouldn't know to re-start checking for ads so you'd need to do that on a timer after x mins.
p.s. I still think you should just display your image via Mobclix in-house custom ad.
EDIT 2:
in your header file put:
- (void)adView:(MobclixAdView*)adView didFailLoadWithError:(NSError*)error;
in your implementation file put:
- (void)adView:(MobclixAdView*)adView didFailLoadWithError:(NSError*)error {
NSLog(#" error : %#", error);
NSLog(#"Ad error code: %d", [error code]);
}
then you should be able to just check which error code you have and act accordingly.

Related

Facebook posting error in ios

Here i am trying to add a post to facebook using following code.
FBAppCall *appCall = [FBDialogs presentShareDialogWithLink:urlToShare
name:#"Title"
caption:nil
description:#"description"
picture:nil
clientState:nil
handler:^(FBAppCall *call, NSDictionary *results, NSError *error) {
if (error) {
NSLog(#"Error: %#", error.description);
} else {
NSLog(#"Success!");
}
}];
But this isn't working. It give following error.
Error Domain=com.facebook.Facebook.platform Code=102 "The operation couldn’t be completed. (com.facebook.Facebook.platform error 102.)" UserInfo=0x1cde3340 {error_code=102, action_id=E780C3AA-1387-4B9C-9A3A-9A16FB54BC59, error_message=An error occurred during publishing., app_id=558567750859724}
Here i am working on cocos2d, is this can be the reason.
Go to your app's settings under the Facebook developer portal.
Go to open graph > types
Choose the action type using and turn on "User Generated Images" for that action type. Save these settings and try again. It will work.
I encountered this error as well, make sure you disable the sandbox mode in Facebook admin panel before distributing to any other user :P
I recently encountered this error when the link I tried to post did not load correctly (was loading a 404 page). Not sure why, but maybe Facebook requires the link work.. Either way they need to make their error messaging more specific.

Facebook image upload on a page working properly in simulator but not in device

When I run same code in simulator I get success Response for image post:
{
id = 248572435289479;
"post_id" = "244759709004085_248572441956145";
}
When I run in same code in device I get:
Error Domain=facebookErrDomain Code=10000 "The operation couldn’t be completed. (facebookErrDomain error 10000.)" UserInfo=0x208a8dd0 {error={
code = 1;
message = "(#1) An unknown error occurred";
type = OAuthException;
}}
"
OAuthException means that there was an authentication issue. Be sure that the following are true on your device.
You are logged into a facebook account successfully
If you are, then remove the app from the phone
Do a clean and re-deploy to the phone
If none of the above work, try logging out in Settings on the phone and logging back in. Then try logging in through safari. Sometimes the iOS facebook authentication can be a little buggy. Also try a different app that is guaranteed to work with iOS facebook accounts. Something like, Hootsuite.
If there is still an issue after all that... I am not sure what you tell you.
This link might help you.
and #giff's answer also explains it to some extent on this link.
log of your issue in this might help you to get further detail of your error.
- (void)request:(FBRequest *)request didFailWithError:(NSError *)error {
NSLog(#"%#", [error localizedDescription]);
NSLog(#"Err details: %#", [error description]);
};
I recommend you to try this if none of the solutions given above could help you.
Remove the application from the list of authorized applications and authorize it again with the needed permissions.
Hope this works for you

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

Using retweeted_by API with MGTwitterEngine - keeps on returning error 404

I'm trying to add a method to MGTwitterEngine to use twitter's retweeted_by API ( http://dev.twitter.com/doc/get/statuses/:id/retweeted_by ).
Here is what I've added to MGTwitterEngine.m (all the OAuth stuff is done, the other methods inside the engine work fine)
-(NSString *)getUsersWhoRetweetedTweetWithID:(unsigned long)ID {
NSString *path = [NSString stringWithFormat:#"statuses/70482402362933249/retweeted_by.xml"];
return [self _sendRequestWithMethod:nil path:path queryParameters:nil body:nil
requestType:MGTwitterUsers
responseType:MGTwitterUsers];
}
Note: I've already included the .xml format and a status ID - just to ensure there's nothing wrong with the data I'm passing on. When I call [_engine getUsersWhoRetweetedTweetWithID:0]; from my app controller, error 404 is returned "The operation couldn't be completed. (HTTP error 404.)".
I've tried it with a parameters NSDictionary & tried changing the request & response types.
Currently, I don't make use of MGTwitterEngine to check who RTd a tweet, I just use a non OAuth'd method - however this will not return protected users who RTd a tweet.
Can anyone give me a point in the right direction - it's being driving me crazy for the past few days! I really appreciate any input :)
Take a look here.....
How to do a RETWEET on an iPhone twitter app (MGTwitterEngine)
MGTwitterEngine does not support re-tweet method yet .. you have to manually add the parse to MGTwitterEngine .h and .m then the call out would be [_engine sendRetweet:(unsigned Long)];
Now I am in the process of trying to determine how you call out the unsigned long...if any one else has an answer to that I would be happy to hear it myself.

iPhone App Google Analytics

I am having issues setting up Google Analytics for my iPhone Application. I have a website that I have sucesfully been using Google Analytics on, and so I am pretty familiar with how it works.
I set up a new fake domain with the following formation: myapp.mysite.com. I got the UA ID that was made and used that as shown below.
In my iPhone application's "didfinishlaunching" method, I have the following code:
[[GANTracker sharedTracker] startTrackerWithAccountID:#"UA-XXXXXXXX-X"
dispatchPeriod:kGANDispatchPeriodSec
delegate:nil];
NSError *error;
if (![[GANTracker sharedTracker] trackEvent:#"test" action:#"my_action" label:#"my_label" value:-1 withError:&error]) {
NSLog(#"error ocurred");
}
where UA-XXXXXXXX-X is filled in with my ID.
I install the application on my phone, run the app for over 20 minutes, and google analytics still states that "tracking is not installed."
What is wrong here?
Thanks!
Here are a few things to try:
First, try adding
BOOL success = [[GANTracker sharedTracker] dispatch];
to the end of your code and testing the value of success.
Second, I don't see kGANDispatchPeriodSec defined in GANTracker.h. Is this a const that you're creating? Pass in a 0 as the dispatchPeriod instead so dispatches are sent immediately instead of batched. (You'll want to change this before you submit your app.)
Finally, implement GANTrackerDelegate on your class and see what's happening in the trackerDispatchDidComplete:eventsDispatched:eventsFailedDispatch call. This will tell you if your dispatch calls are failing, but unfortunately won't tell you why.
See this link about adopting a protocol on your class. In your .m file, add the following:
#pragma mark GANTrackerDelegate
- (void)trackerDispatchDidComplete:(GANTracker *)tracker
eventsDispatched:(NSUInteger)eventsDispatched
eventsFailedDispatch:(NSUInteger)eventsFailedDispatch {
NSLog(#"events dispatched: %d, events failed: %d", eventsDispatched, eventsFailedDispatch);
}