x

Search in
Sort by:

Question Status:

Search help

  • Simple searches use one or more words. Separate the words with spaces (cat dog) to search cat,dog or both. Separate the words with plus signs (cat +dog) to search for items that may contain cat but must contain dog.
  • You can further refine your search on the search results page, where you can search by keywords, author, topic. These can be combined with each other. Examples
    • cat dog --matches anything with cat,dog or both
    • cat +dog --searches for cat +dog where dog is a mandatory term
    • cat -dog -- searches for cat excluding any result containing dog
    • [cats] —will restrict your search to results with topic named "cats"
    • [cats] [dogs] —will restrict your search to results with both topics, "cats", and "dogs"

IOS OnlineSubsystemFacebook module is not working?

Hello,
I am trying to integrate Facebook in my IOS game but before doing everything manually by myself,i decided to use what's already there in unreal engine source code in OnlineSubsystemFacebook module.

Here is how my code looks like...

In build.cs

 if (Target.Platform == UnrealTargetPlatform.IOS)
         {
             PublicDependencyModuleNames.AddRange(
                 new string[]
                 {
                     "OnlineSubsystem",
                     "OnlineSubsystemFacebook"                       
                 }
             );
 
             PublicIncludePaths.Add("Runtime/Online/OnlineSubsystemFacebook/Private/IOS");
             PublicIncludePaths.Add("Runtime/Online/OnlineSubsystem/Public/Interfaces");
 
 }

FacebookLoginComponent.h

 #pragma once
 
 #include "FacebookLoginComponent.generated.h"
 
 UCLASS()
 class UFacebookLoginComponent : public UActorComponent
 {
     GENERATED_BODY()
     
 public:
     void OnRegister() override;
     void OnUnregister() override;
 
     UFUNCTION(BlueprintCallable, meta = (Keywords = "facebook"), Category = "Facebook")
     static void FacebookLogIn();
  
 }

FacebookLoginComponent.cpp

 #include "FacebookPluginPrivatePCH.h"
 #include "FacebookLoginComponent.h"
 
 #if PLATFORM_IOS
 #include "OnlineIdentityFacebook.h"
 #include "OnlineIdentityInterface.h"
 #endif
 
 void UFacebookLoginComponent::OnRegister()
 {
     Super::OnRegister();
     
     // init here
 }
 
 void UFacebookLoginComponent::OnUnregister()
 {
     Super::OnUnregister();
 }
 
 void UFacebookLoginComponent::FacebookLogin()
 {
 
 #if PLATFORM_IOS
 
     FOnlineIdentityFacebook SetUpLogin;
     FOnlineAccountCredentials AccountCredentials;
     AccountCredentials.Type = "Facebook";
     AccountCredentials.Id = "email";
     AccountCredentials.Token = "password";
     
     SetUpLogin.Login(1,AccountCredentials);
 
 #endif
 
 }


I am calling the FacebookLogin() when a button is clicked in game.
It shows the Facebook login screen and after completing the login process,i am getting a blank white screen.
Normally,it should switch back to the game,but,it is not doing so.Here's an image of the screen after login.

White screen

When i click "Done" nothing happens and when,i take a look in the log,it shows that user has cancelled login message. And throws an error as shown in the image below.

Error message

I have added the necessary settings for Facebook integration in my plist as mentioned in the getting started guide of Facebook. I am using ios 9.
Am i doing something wrong? Please help!
Thank you!

Product Version: UE 4.9
Tags:
more ▼

asked Nov 06 '15 at 10:37 AM in Bug Reports

avatar image

Superflare
130 6 7 15

(comments are locked)
10|2000 characters needed characters left
Viewable by all users

2 answers: sort voted first

Hi Superflare,

There are a couple of things here that I'd like to go over. The use of OSS Facebook in the explicit manner is not recommended.

Instead, I suggest that you use the OSS interfaces to manage Online Subsystem

 const FName FacebookOSSName("Facebook");
 
 IOnlineIdentityPtr OnlineIdentity = Online::GetIdentityInterface(FacebookOSSName);
 if (OnlineIdentity.IsValid())
 {
     OnlineIdentity->AddOnLoginCompleteDelegate_Handle(0, OnLoginCompleteDelegate);
     OnlineIdentity->AddOnLogoutCompleteDelegate_Handle(0, OnLogoutCompleteDelegate);
 
     OnlineIdentity->Login(0, AccountCredentials);
 }

I would also drop the PublicIncludePaths that were added, as this completely bypasses any reason the files are private.

Any activities you wish to continue with after login should be managed through your OnLoginCompleteDelegate delegate.

Hope this helps. /Terence

more ▼

answered Nov 09 '15 at 02:19 PM

avatar image Superflare Nov 10 '15 at 11:01 AM

Thank you,Terence!

I didn't know about OSS interface,i will look into it now.
I have actually went the manual way for integrating Facebook as i think that the OSS Facebook module is still under development and i am trying to stay away from editing anything in UE4 source code.

It is working fine so far but the only thing that worries me is this line in my code..

 FIOSCoreDelegates::OnOpenURL.AddStatic(&FacebookOpenURLHandler);

I mean,i am not sure how to remove it when it is unregistered.
Usually for the methods added with AddUObject,i use this..

 SomeDelegate.RemoveAll(this);

I am not sure,how to do it for AddStatic.

(comments are locked)
10|2000 characters needed characters left
Viewable by all users

I am not sure,what i was doing wrong,but,after creating another project and trying it again,it worked.Maybe,my project got corrupted as i was facing some other issues too with it.

Thank you!

more ▼

answered Nov 06 '15 at 06:33 PM

avatar image

Superflare
130 6 7 15

(comments are locked)
10|2000 characters needed characters left
Viewable by all users
Your answer
toggle preview:

Up to 5 attachments (including images) can be used with a maximum of 5.2 MB each and 5.2 MB total.

Follow this question

Once you sign in you will be able to subscribe for any updates here

Answers to this question