facebook ios sdk isn't working. iphone - 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.

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.

android facebook login button does not work

I'm following this tutorial "Facebook Login Flow for Android" (https://developers.facebook.com/docs/howtos/androidsdk/3.0/login-with-facebook/) to create a simple app containing only one facebook login button to test facebook login.
However, I've been having trouble logging in facebook with this button.... I've been following every step in this tutorial and I've double checked everything -- it is exactly the same as in this tutorial. I see other people who have similar problems are always because of incorrect debug hash code. But I've checked like a million times that I got the correct debug hash code. Some people say that if you wanna release an app, you need a release code. However, I'm not releasing my app -- I'm just testing it on an android device, so I guess I dont really need a release code to do that?
Also, I've checked that I've included my facebook application id for this app in the Android Manifest. So basically, everything I did was strictly following the tutorials on Facebook Developers.
I've seen some people suggesting to use the "keytool" in JDK 6 in stead of JDK 7. And I've checked that I actually did generate my debug hash code with the "keytool" in JDK 6.
So I've tried everything, but the problem still exists!
In that Android Tutorial, it suggests putting this in your code so that you can monitor your LogCat to see if your current state is logged in or logged out:
private void onSessionStateChange(Session session, SessionState state, Exception exception) {
if (state.isOpened()) {
Log.i(TAG, "Logged in...");
} else if (state.isClosed()) {
Log.i(TAG, "Logged out...");
}
}
In my case, no matter how many times I clicked Facebook Login Button, I always got "Logged out..." in my LogCat.
Also, the funny thing is, I can't even log in facebook using those sample apps coming with Facebook Android SDK 3.0.1 (eg. SessonLoginSample)!!!!! When I click the login button in those sample apps, nothing happens -- which means I'm not successfully logged in.
I really hope you guys out there can help me with this problem. It's weird I don't see other people with the exact same problem (as I said, those with similar problems are always because of incorrect debug code, but I've checked mine, it is 100% correct). THANK YOU SO MUCH!
It happened to me once. You might have added the export key hash in facebook developer setting.
Add these lines to your code to get your debugging key hash and then add to facebook.
for (Signature signature : info.signatures) {
MessageDigest md = MessageDigest.getInstance("SHA");
md.update(signature.toByteArray());
Log.d("KeyHash:", Base64.encodeToString(md.digest(), Base64.DEFAULT));
}

Phonegap Android Facebook plugin publish_stream permission request throws "Error calling method on NPObject"

I'm using Phonegap for Android and I have just integrated Facebook plugin(https://github.com/phonegap/phonegap-facebook-plugin) to my project. I need to get an AccessToken that could be sent to server so that server could post on user's behalf.
When I at first called FB.login(callback, {scope:'email,user_birthday,user_location'}) everything works fine and dandy. But if I add 'publish_stream' permission to the scope I get an error: "Uncaught Error: Error calling method on NPObject". Error is originating from cordova.js (phonegap 2.8) on line 863 which is:
var messages = nativeApiProvider.get().exec(service, action, callbackId, argsJson);
I initialize the plugin in the next manner:
FB.init({
appId: Global.Facebook.apiKey,
nativeInterface: CDV.FB,
useCachedDialogs: false,
});
If I remove that permission from scope all works ok. Perhaps anyone has some experience or thoughts on how to fix such issue? I debug my app on my phone (Samsung Galaxy S2 connected via USB debugging feature) and for IDE I use adt-bundle's Android Developer Tools (basicly eclipse);
Many thanks in advance.
I seem to have gotten to the root of the problem. When logging in initially, I can't ask for write ("publish") permissions. As I understand I must ask them later after initial login. Which is abit uncomfortable for me, since I might have to prompt user for permissions several times during a single use-case which is bad. Perhaps I am missing some documentation page where all that stuff is already mentioned?
I've founded !!
Go to FacebookSDK Project -> Properties -> Java Build Path -> Order and Export (tab) -> Make sure android-support-v4.jar is checked. Then do a clean and launch...
Great ?
Use this in your session for publish and read permissions (extended permission.)
session.reauthorizeForPublish

iOS Push Notifications doesn't work on my device

I did everything in this tutorial:
http://www.raywenderlich.com/3443/apple-push-notification-services-tutorial-part-12
I created certificates, app_id and a Provisioning profile and try to use Push Notification Service with simple code below in delegate file:
self.window.rootViewController = self.viewController;
[self.window makeKeyAndVisible];
// Let the device know we want to receive push notifications
[[UIApplication sharedApplication] registerForRemoteNotificationTypes:
(UIRemoteNotificationTypeBadge | UIRemoteNotificationTypeSound | UIRemoteNotificationTypeAlert)];
I tried my app on my iPad but it doesn't work. iOS doesn't ask me if I allow my app to use Push Notifications, also doesn't show my app in Settings>Notifications list.
I don't get an error while compiling or running my app..
Error
I just implemented "didFailToRegisterForRemoteNotificationsWithError" method and I am getting this error while running application
2013-03-31 00:11:10.481 PushAppCalisma [272:907] {
NSLocalizedDescription = "no valid 'aps-environment' entitlement string found for application";
}
You need to create a dev provisioning profile, linked to that specific app id (The one you created por push notifications), then remember to test it in a real device, simulator can't receive push notifications!
All right, I solved the problem. Probably people who are new to ios and uses Push Notifications first time will make this mistake.
Solution:
Do everything in this tutorial:
http://www.raywenderlich.com/3443/apple-push-notification-services-tutorial-part-12
After, follow these steps:
1- Open XCode and open Organizer (Window>Organizer)
2- In left side pane, under Library section, click Provisioning Profile tab and refresh table. If you can't see the provisioning profile that you just created click "import" and select the "*.mobileprovision" file (tutorial explains how you create a provisioning profile and download provision file).
After importing, restart Xcode, click the project name
3- In Code Signing Identity (Under Build Settings tab), set attributes to Provisioning Profile for both "Targets" and "Projects" tabs.

BlackBerry Facebook jar file in eclipse

I know this might sound a very basic question but I am having an issue in using Facebook SDK for Blackberry. I have downloaded the latest one 0.8.25. I have imported them in my eclipse and they are present in the referenced libraries. I have a game app where I want the users to login using their facebook account. Which class contains the code for logging in? Are the jar files implementable or they are just for reference? I have read forums posts where users say that they executed Strawberry program but I can no where find any executable source code. Kindly please let me know how do I create a login page for BlackBerry using its SDK. I did go through another link of Sample Code here!
Let me know which class has login code or how do i use the SDK
At the very basic least, you need to get an instance of the Facebook object and call getCurrentUser(). So, for example:
String[] permissions = new String[] { Facebook.Permissions.ALL_PERMISSIONS };
Facebook fb = Facebook.getInstance(new ApplicationSettings(myNextUrl, myAppId, myAppSecret, permissions));
User fbUser = fb.getCurrentUser();
The code in the library will handle all of the details like getting the user to login to facebook account and accept the requested permissions and so on. You'll want to wrap that all in a try/except to catch FacebookException for error conditions (e.g. user refuses your request).