Coder Social home page Coder Social logo

nodrock / ane-facebook Goto Github PK

View Code? Open in Web Editor NEW

This project forked from freshplanet/ane-facebook

8.0 8.0 2.0 143.44 MB

Air Native Extension (iOS and Android) for the Facebook mobile SDK

License: Apache License 2.0

ActionScript 3.62% Java 73.66% Objective-C 21.67% C 1.05%

ane-facebook's People

Contributors

adamfp avatar alexish avatar ataugeron avatar florianbernard avatar freshtiti avatar iiilx avatar kirillkuvaldin avatar mastergenius avatar nigamshah avatar nodrock avatar pnico avatar renaudbardet avatar rraway avatar shinyamos avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar

ane-facebook's Issues

In emulator isSupported returns true

It is a small issue for developers. You can check if are on emulator like this:

static public function isMobile():Boolean {
   return (isAndroid() || isIOS()) && Capabilities.os.indexOf("Windows") == -1;
}

App crash when another invoke event is caught.

I encountered a serious problem, when I try to open my app from a push notification when the app is at closed state causes it to crash as soon as facebook init is called on ios.

The crash happens right after I call Facebook.getInstance().init("123456789"); and only if I open the app from a push notification.

I use a INVOKE event listener to get the push data, which is also used in AS3 part of the Facebook ANE.

Adobe states that whenever you add a listener for invoke events, you'll get the previous invoke events, therefore a delayed call to the facebook init doesn't solve the issue.

I tried fixing the problem from as3 side by checking if the invoke event is for facebook by editing the Facebook.as class by adding the code below, but it didn't fix it.

    if (event.reason == InvokeEventReason.NOTIFICATION)
    {
        Logger.log("Wrong Invoke Event was caught. Ignoring.");
        return;
    }

And flash console doesn't log anything prior to crash which got me into thinking it's a native code related issue.

I'm not using a native extension for push notifications, just as3. I haven't got any time to test it with the freshplanet push notification extension but if anyone tried using both extensions can you please test the issue there? If the app doesn't crash with the push notification extension I can switch to it.

I'm testing on AIR 17, iPhone 5s

Thanks.

Issue with AIR SDK 20.0

When trying to update my build-chain to use AIR SDK 20.0, it would compile but I ran into a runtime issue with the Facebook login.

Calling the Facebook.accessToken method:

Type coercion error from com.freshplanet.ane.AirFacebook:FBAccessToken@1234567 to com.freshplanet.ane.AirFacebook.FBAccessToken

Using the build with the res-facebook folder renaming.

Android synchronized init fails to load

Thank you for the great native extension. I've updated to the recent code, version 4.5.1 and iOS works great, however android crashes for me when I load the ANE( pre-launch of the game ). I've tracked it down to commit #218fcd8 and specifically the syncronized init with call back in the InitFacebookFunction.java file. If I use a different method, I can load the ANE. I'm a bit puzzled as I do not get much in the way of debug messages. I am using java 1.7.0_45 and Air SDK 18.0.0.199. Replacing the Facebook.sdkInitialize( context, Facebook.InitializeCallback ) with Facebook.sdkInitialize( context ) will allow the ANE to load and run.

Building from the command line package issues...( aapt tool failed: ... )

Hi all,
I have an issue when I build our app with this ANE from the command line. I receive a large number of errors on the package step. I am trying to see what is different between the FlashBuilder 4.7 build and the command line build with exported config, but some how I think I am not setting the default language properly( -locale en_US ). I get these errors when packaging, and they seem related to the Facebook ANE. I've included all of the errors, however it is quite verbose. I wanted to repeat, this works fine when debugging from the IDE.

Thanks for any help!

--John

aapt tool failed:/private/var/folders/_n/pvx2q2pd6m98v9jt79txcnk80000gn/T/6db969e8-7781-4255-9c8b-0ee8714afdfb/res/layout/com_facebook_tooltip_bubble.xml:44: error: Error: No resource found that matches the given name (at 'style' with value '@style/tooltip_bubble_text').
/private/var/folders/_n/pvx2q2pd6m98v9jt79txcnk80000gn/T/6db969e8-7781-4255-9c8b-0ee8714afdfb/res/drawable/com_facebook_button_background.xml:26: error: Error: No resource found that matches the given name (at 'color' with value '@color/com_facebook_button_background_color_disabled').
/private/var/folders/_n/pvx2q2pd6m98v9jt79txcnk80000gn/T/6db969e8-7781-4255-9c8b-0ee8714afdfb/res/drawable/com_facebook_button_background.xml:32: error: Error: No resource found that matches the given name (at 'color' with value '@color/com_facebook_button_background_color_pressed').
/private/var/folders/_n/pvx2q2pd6m98v9jt79txcnk80000gn/T/6db969e8-7781-4255-9c8b-0ee8714afdfb/res/drawable/com_facebook_button_background.xml:38: error: Error: No resource found that matches the given name (at 'color' with value '@color/com_facebook_button_background_color').
/private/var/folders/_n/pvx2q2pd6m98v9jt79txcnk80000gn/T/6db969e8-7781-4255-9c8b-0ee8714afdfb/res/drawable/com_facebook_button_like_background.xml:26: error: Error: No resource found that matches the given name (at 'color' with value '@color/com_facebook_button_background_color_disabled').
/private/var/folders/_n/pvx2q2pd6m98v9jt79txcnk80000gn/T/6db969e8-7781-4255-9c8b-0ee8714afdfb/res/drawable/com_facebook_button_like_background.xml:32: error: Error: No resource found that matches the given name (at 'color' with value '@color/com_facebook_button_background_color_pressed').
/private/var/folders/_n/pvx2q2pd6m98v9jt79txcnk80000gn/T/6db969e8-7781-4255-9c8b-0ee8714afdfb/res/drawable/com_facebook_button_like_background.xml:38: error: Error: No resource found that matches the given name (at 'color' with value '@color/com_facebook_button_like_background_color_selected').
/private/var/folders/_n/pvx2q2pd6m98v9jt79txcnk80000gn/T/6db969e8-7781-4255-9c8b-0ee8714afdfb/res/drawable/com_facebook_button_like_background.xml:44: error: Error: No resource found that matches the given name (at 'color' with value '@color/com_facebook_button_background_color').
/private/var/folders/_n/pvx2q2pd6m98v9jt79txcnk80000gn/T/6db969e8-7781-4255-9c8b-0ee8714afdfb/res/drawable/com_facebook_button_login_silver_background.xml:26: error: Error: No resource found that matches the given name (at 'color' with value '@color/com_facebook_button_background_color_disabled').
/private/var/folders/_n/pvx2q2pd6m98v9jt79txcnk80000gn/T/6db969e8-7781-4255-9c8b-0ee8714afdfb/res/drawable/com_facebook_button_login_silver_background.xml:32: error: Error: No resource found that matches the given name (at 'color' with value '@color/com_facebook_button_login_silver_background_color_pressed').
/private/var/folders/_n/pvx2q2pd6m98v9jt79txcnk80000gn/T/6db969e8-7781-4255-9c8b-0ee8714afdfb/res/drawable/com_facebook_button_login_silver_background.xml:38: error: Error: No resource found that matches the given name (at 'color' with value '@color/com_facebook_button_login_silver_background_color').
/private/var/folders/_n/pvx2q2pd6m98v9jt79txcnk80000gn/T/6db969e8-7781-4255-9c8b-0ee8714afdfb/res/drawable/com_facebook_button_send_background.xml:26: error: Error: No resource found that matches the given name (at 'color' with value '@color/com_facebook_button_background_color_disabled').
/private/var/folders/_n/pvx2q2pd6m98v9jt79txcnk80000gn/T/6db969e8-7781-4255-9c8b-0ee8714afdfb/res/drawable/com_facebook_button_send_background.xml:32: error: Error: No resource found that matches the given name (at 'color' with value '@color/com_facebook_button_send_background_color_pressed').
/private/var/folders/_n/pvx2q2pd6m98v9jt79txcnk80000gn/T/6db969e8-7781-4255-9c8b-0ee8714afdfb/res/drawable/com_facebook_button_send_background.xml:38: error: Error: No resource found that matches the given name (at 'color' with value '@color/com_facebook_button_send_background_color').

iOS app crash on facebookConnect

Please advise me anyone. I stuck with this issue for a while. I don't have much experience in flash builder. I don't know if it is possible to debug inside _context.call().

When I call this loginWithReadPermissions, the app crashed on
Facebook.as:472 >>> _context.call('logInWithPermissions', permissions, type);

This is how I code.

this._facebook.init("fb315498341803045", function ():void {
trace("Done FACEBOOK initialized ");
});

this._facebook.setLoginBehavior(FBLoginBehaviorIOS.WEB, FBLoginBehaviorAndroid.WEB_ONLY);
var permissions:Array = new Array();
permissions.push("email", "user_friends");
this._facebook.logInWithReadPermissions(permissions, onConnected);

This is my iOS plist.

    <InfoAdditions><![CDATA[
      <key>UIDeviceFamily</key>
      <array>
          <string>1</string>
          <string>2</string>
      </array>
      <key>CFBundleURLTypes</key>
      <array>
          <dict>
              <key>CFBundleURLSchemes</key>
                  <array>
                      <string>fbxxx</string>
                  </array>
          </dict>
      </array>
      <key>FacebookAppID</key>
          <string>fbxxx</string>
      <key>FacebookDisplayName</key>
          <string>AppNameOnFacebook</string>
  ]]></InfoAdditions>

Test device information.
iOS ver 8.2 , 9.0.1
AIR SDK V18
I also had "-swf-version=29" in my additional compiler arguments.

AppInviteDialogFunction not working on android

Thanks for this great extension.

The appInviteDialogue function is not opening the dialogue on android. The rest of the features are working perfectly. Am I supposed to add some activity in the android manifestAdditions for the invite dialogue?

When I call the function, the following trace happens but no dialogue is opened:
[AirFacebook][NATIVE] AppInviteDialogFunction

The invite dialogue is working on iOS.

Graph API requests fail.

I'm having problems with getting data from Graph API, I can log the token, I can use the token in Graph API Explorer (https://developers.facebook.com/tools/explorer/), but when I try to use it in my app it returns this:

Object: { body: { error: { message: An active access token must be used to query information about the current user., type: OAuthException, code: 2500 } }, code: 400 }

I tried logOut then getting a new token still the same error every time.

Here's my code for logging in.

        Facebook.getInstance().init("{my_app_id}");

        Facebook.getInstance().logOut();  //For testing purposes.

        var permissions:Array = new Array();
        permissions.push("email", "user_birthday");

        Facebook.getInstance().setLoginBehavior(FBLoginBehaviorIOS.WEB, FBLoginBehaviorAndroid.WEB_ONLY);

        Facebook.getInstance().logInWithReadPermissions(permissions, onSessionRecieved);

And when I receive the session:

        Logger.log("session received : " + "success : " + success.toString() + " userCancelled : " + userCancelled.toString() +" error : " + error);

// returns : session received : success : true userCancelled : false error : null

        Logger.log("Facebook Token : " + Facebook.getInstance().accessToken.tokenString);

// returns a working token which can be used in Graph API Explorer

Finally I do this

Facebook.getInstance().requestWithGraphPath("/me?fields=id,name,first_name,last_name,birthday,picture,email", null, "GET", onFacebookInfoRecieved);

AND BAM

{ body: { error: { message: An active access token must be used to query information about the current user., type: OAuthException, code: 2500 } }, code: 400 }

I need help here. Thanks.

Binary release?

Hey, thanks for taking over the unmaintained yet important Facebook ANE.

More a small request than an issue.

It's possible to associate your release with binary files on GitHub. Would be nice to have the compiled ANE up there :-)

Cheers!

ios: problem with login / always get canceled

hey,

I got user canceled back althought I pressed okay. ;(
Thanks for help!
Facebook App is setuped.
App.xml is setup with right "id>", key>CFBundleURLSchemes/key>, key>FacebookAppID/key> ,key>FacebookDisplayName/key> and extensionID>com.freshplanet.AirFacebook/extensionID>

Here is a sum of the code:
import com.freshplanet.ane.AirFacebook.Facebook;

private var _facebook : Facebook;

this._facebook = Facebook.getInstance();
Facebook.logEnabled = true;
Facebook.nativeLogEnabled = true;
this._facebook.init( "AppId" );

this._facebook.logInWithReadPermissions( [ "email" ], this.onSessionOpened );

private function onSessionOpened( bIsSuccess : Boolean, bIsUserCancelled : Boolean, error : String ) : void {
this._facebook.requestWithGraphPath( "me", null, "GET", this.onGraphReturned );
}

[AirFacebook][AS3] FACEBOOK about to call handleOpenURL on args: [] with reason: standard
[AirFacebook][NATIVE] initFacebook
[AirFacebook][NATIVE] Trying to open session with read permissions: email
[AirFacebook][AS3] FACEBOOK about to call handleOpenURL on args: [] with reason: standard
[AirFacebook][NATIVE] Login failed! User cancelled! (Error details : (null) )
[AirFacebook][AS3] No access token!
[AirFacebook][NATIVE] getAccessToken
[AirFacebook][AS3] FACEBOOK about to call handleOpenURL on args: [] with reason: standard
[AirFacebook][NATIVE] Trying to open session with read permissions: email
[AirFacebook][AS3] FACEBOOK about to call handleOpenURL on args: [] with reason: standard
[AirFacebook][NATIVE] Login failed! User cancelled! (Error details : (null) )
[AirFacebook][AS3] No access token!
[AirFacebook][NATIVE] getAccessToken

AppRequestDialog:null exception when parcel'd and frictionless friends

While implementing the latest version with 4.5.3 and GameRequestContent, I have an issue where I am using the 'to' field. To use the GameRequestContent, you must exclusively use 'to', 'filters' or 'suggestions' or validation will fail in the GameRequestValidation. I can't use null in the filters value as that will cause a null reference exception when the GameRequestContent is parcel'd for the activity. I have added the missing CREATOR, but now I am having to add some code to support a null filters value.

Also as a side note is it possible to implement frictionless app requests on android? I was able to do this by setting a flag on the ios dialog, but don't see an easy way to do this with android.

Thank you for your time,

--John

Add Android-x86 support

What about to add Android-x86 support? It's so simple.

<arg line="-platform Android-x86 -platformoptions ../platform-android.xml -C android/ ."/>

build.xml

<platform name="Android-x86">
    <applicationDeployment>
        <nativeLibrary>libAirFacebook.jar</nativeLibrary>
        <initializer>com.freshplanet.ane.AirFacebook.AirFacebookExtension</initializer>
        <finalizer>com.freshplanet.ane.AirFacebook.AirFacebookExtension</finalizer>
    </applicationDeployment>
</platform>

extension.xml

That's all.

Compile the ANE

Hey, it's been a while! 😄

In order to build the ANE, I had to perform the following change:

diff --git a/android/build.gradle b/android/build.gradle
index 8a555cd..d358cce 100644
--- a/android/build.gradle
+++ b/android/build.gradle
@@ -7,9 +7,10 @@ repositories {
 project.group = 'com.facebook.android'

 dependencies {
-    compile 'com.android.support:support-v4:[22,23)'
+    // compile 'com.android.support:support-v4:22+'
     compile 'com.parse.bolts:bolts-android:1.2.0'
     compile files('libs/FlashRuntimeExtensions.jar')
+    compile files('libs/android-support-v4.jar')
 }

 android {

Seems wrong? Else, I can make a pull request.

App Invite dialog: The operation couldn’t be completed

I sometimes get this error and app invite dialog is not opened. Has anyone has the same issue?

[AirFacebook][NATIVE] APPINVITE_ERROR error: Error Domain=com.facebook.sdk.core Code=9 "The operation couldn’t be completed. (com.facebook.sdk.core error 9.)"

I think it only happens when I don't have Facebook application installed but I am not sure.

Facebook.getInstance().accessToken return null on Android

If you call Facebook.getInstance().accessToken immediately after Facebook.getInstance().init(), it always return null on Android, because Facebook call to Facebook.sdkInitialize() is async and Facebook don't provide callback in FB Android SDK 4.2.

Workaround: Call init() as soon as possible and check for accessToken later. Or you can use setTimeout.

Solution: I will upgrade FB Android SDK to version 4.4 where Facebook added callback and I will provide it to you.

Invalid app ID

Getting better, it's now starting with AIR 18. I can open the facebook login dialog... however it fails:

Invalid App ID: fb123456789

Checked the Key Hashes (in case that could be related), seems good... Could it be possible the Facebook App doesn't like this "fb" in front of the ID?

bin folder

Hello,

Thanks for your job on this ANE.
Where is the bin folder with the ANE?
Thanks a lot.

Missing check for InvokeEventReason.OPEN_URL in onInvoke() handler

I'm currently using your ane for both android and ios and I have a small problem.

When my app is opened through a push notification, the invoke event gets caught by the facebook ane from as3 side and calls the native ios code as if it has received data from facebook, which causes the app to crash as soon as Facebook.init is called.

My request from you is to simply add the following lines to the top of the invoke event listener function so that it doesn't handle notification invokes. And package the ane for me.
I can't build the ane and if I use another class to handle facebook this time android throws me errors.

Here's the code i'd like you to add:

if (event.reason == InvokeEventReason.NOTIFICATION)
{
    log("Wrong Invoke Event was caught. Ignoring.");
    return;
}

Thanks in advance, Great work on the ane by the way.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.