Unity3D 5.3, Facebook SDK does not work in iOS - ios

I want to login into Facebook and share some info. Here is code
using UnityEngine;
using System.Collections.Generic;
using Facebook.Unity;
using System;
public class FBManager : MonoBehaviour {
void Awake()
{
FB.Init(Init);
}
void Init()
{
Debug.Log("initialized");
}
public void Share()
{
if (FB.IsLoggedIn)
{
Debug.Log("going to call FB.ShareLink()");
FB.ShareLink(new Uri("http://www.google.com/"), "google", "google super search engine", null,ShareCallback);
}
else
{
Debug.Log("going to call Login()");
Login();
}
}
private void Login()
{
FB.LogInWithPublishPermissions(new List<string>() { "publish_actions" }, LoginCallback);
}
void LoginCallback(ILoginResult result)
{
Debug.Log("error: " + result.Error);
if (result.Error != null)
Debug.LogError(result.Error);
else
{
Debug.Log("logged? " + FB.IsLoggedIn);
Share();
}
}
void ShareCallback(IShareResult result)
{
if (result.Error != null)
Debug.LogError(result.Error);
else
Debug.Log("sharing done");
}
}
And when it calls Login() method it gives an error
2015-12-14 17:36:25.910 TheMyAppName[741:307812] *** Terminating app
due to uncaught exception 'InvalidOperationException', reason: 'fb0 is
not registered as a URL scheme. Please add it in your Info.plist'
How do I fix it? It happens only when I'm making XCODE project with Unity 5.3, in Unity 5.2 all is right.

probably something's wrong with fb Unity sdk. This is how you integrate FB SDK in iOS. So probably you should manually implement the step 3 in xCode. If it throws another similar error just copy the scheme from the error log and again add it to plist.

Related

Unity IronSource Ads iOS error on intialization

I'm trying to integrate IronSource ads into my Unity Project. When I build my app, open it in XCode and run it on my iPhone 6s for testing, I get a message telling me that the IronSource API hasn't got an Interstitial.
The Error Message is:
"(DATE) AdManager(<- The Name of my Script) [ironSource SDK] API: IronSource: hasINterstitial false"
Also, the Interstitial Ad does not initialize. So "IronSource.Agent.isInterstitialReady()" stays false.
What am I doing wrong?
I have imported the SDK and I wrote this Script (C#):
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class AdManager : MonoBehaviour
{
private string AppKey = "MY_APP_ID";
void Start()
{
Invoke("InitInterstitial", 4);
}
#region interstitial
private void InitInterstitial()
{
IronSource.Agent.init(AppKey, IronSourceAdUnits.INTERSTITIAL);
while (!IronSource.Agent.isInterstitialReady()) { Debug.Log("Initializing..."); }
Debug.Log("Initialized!");
IronSource.Agent.loadInterstitial();
Debug.Log("Loaded!");
}
void OnEnable()
{
IronSourceEvents.onInterstitialAdReadyEvent += InterstitialAdReadyEvent;
IronSourceEvents.onInterstitialAdLoadFailedEvent += InterstitialAdLoadFailedEvent;
IronSourceEvents.onInterstitialAdShowSucceededEvent += InterstitialAdShowSucceededEvent;
IronSourceEvents.onInterstitialAdShowFailedEvent += InterstitialAdShowFailedEvent;
IronSourceEvents.onInterstitialAdClickedEvent += InterstitialAdClickedEvent;
IronSourceEvents.onInterstitialAdOpenedEvent += InterstitialAdOpenedEvent;
IronSourceEvents.onInterstitialAdClosedEvent += InterstitialAdClosedEvent;
}
//Invoked when the initialization process has failed.
//#param description - string - contains information about the failure.
void InterstitialAdLoadFailedEvent(IronSourceError error)
{
Debug.LogError("ERROR!!__: " + error);
}
//Invoked right before the Interstitial screen is about to open.
void InterstitialAdShowSucceededEvent()
{
}
//Invoked when the ad fails to show.
//#param description - string - contains information about the failure.
void InterstitialAdShowFailedEvent(IronSourceError error)
{
}
// Invoked when end user clicked on the interstitial ad
void InterstitialAdClickedEvent()
{
}
//Invoked when the interstitial ad closed and the user goes back to the application screen.
void InterstitialAdClosedEvent()
{
}
//Invoked when the Interstitial is Ready to shown after load function is called
void InterstitialAdReadyEvent()
{
Debug.Log("_______READY!_____");
}
//Invoked when the Interstitial Ad Unit has opened
void InterstitialAdOpenedEvent()
{
}
public void ShowInterstitial()
{
IronSource.Agent.showInterstitial();
}
#endregion
}
(The Debug.Logs are only for debugging my problem)
Thanks for your Help!
It looks like the while loop never ends.
The function that actually triggers the ad request is:
IronSource.Agent.loadInterstitial();
Try to do the following:
private void InitInterstitial()
{
IronSource.Agent.init(AppKey, IronSourceAdUnits.INTERSTITIAL);
Debug.Log("Initializing..."); }
IronSource.Agent.loadInterstitial();
}
//Invoked when the Interstitial is Ready to shown after load function is called
void InterstitialAdReadyEvent()
{
Debug.Log("Ad Loaded");
}

Why BiometricPrompt API in Xamarin Android doesn't contain onAuthenticationError Callback

In Android Studios BiometricPrompt API contains a callback named onAuthenticationError which gets triggered when the user touch outside the BiometricPrompt dialog and once a user tries to input an invalid Biometric to the device. But the BiometricPrompt API available in Xamarin.Android platform doesn't provide onAuthenticationError callback.
I created an android application using Android Studios to check BiometricPrompt API there I could access the callback named onAuthenticationError. Then I deployed the application to a device and debugged the application. The above mentioned callback got triggered when I touched any area outside the BiometricPrompt dialog and it also got triggered every time I provided BiometricPrompt with a invalid input more than 5 times.
Then I tried developing the same application in Xamain.Android and there I was unable to find any callback named onAuthenticationError. When I deployed and tested the application in a device as the above-mentioned callback was not available I couldn't handle the 2 scenarios
where when the user touches any area outside the BiometricPrompt dialog and when user provides the BiometricPrompt with an invalid input more than 5 times.
My Native android code snippet.
#RequiresApi(api = Build.VERSION_CODES.P)
private BiometricPrompt.AuthenticationCallback getAuthenticationCallback() {
return new BiometricPrompt.AuthenticationCallback() {
#Override
** public void onAuthenticationError(int errorCode,
CharSequence errString) {
notifyUser("Authentication error: " + errString);
super.onAuthenticationError(errorCode, errString);
}**
#Override
public void onAuthenticationHelp(int helpCode,
CharSequence helpString) {
super.onAuthenticationHelp(helpCode, helpString);
}
#Override
public void onAuthenticationFailed() {
super.onAuthenticationFailed();
}
#Override
public void onAuthenticationSucceeded(
BiometricPrompt.AuthenticationResult result) {
notifyUser("Authentication Succeeded");
super.onAuthenticationSucceeded(result);
}
};
}
My Xamarin.Android code snippet
public class BiometricAuthCallBacks : BiometricPrompt.AuthenticationCallback
{
public TaskCompletionSource<LocalAuthStatus> promise = new TaskCompletionSource<LocalAuthStatus>();
private int failCount;
public override void OnAuthenticationSucceeded(BiometricPrompt.AuthenticationResult result)
{
base.OnAuthenticationSucceeded(result);
promise.TrySetResult(LocalAuthStatus.Success);
//Success(result);
}
public override void OnAuthenticationFailed()
{
base.OnAuthenticationFailed();
failCount++;
if (failCount>=5)
{
promise.TrySetResult(LocalAuthStatus.Fail);
}
//Failed();
}
public override void OnAuthenticationHelp([GeneratedEnum] BiometricAcquiredStatus helpCode, ICharSequence helpString)
{
base.OnAuthenticationHelp(helpCode, helpString);
promise.TrySetResult(LocalAuthStatus.Error);
//Help(helpCode, helpString);
}
}
My Question is why can't I access onAuthenticationError callback from Xamarin.Android platform and how can I resolve this?

Twitter Login crash

I am developing an app with Twitter login. When I am checking Fabric, it doesn't contain Twitter login as it's no longer available via Fabric, so I am trying to implement it using Twitter Kit (Twitter Kit Link).
I have installed Twitter Kit on my app, when I am trying to run the app it crashes on
Twitter.sharedInstance().startWithConsumerKey(<key>, consumerSecret: <secret>)
Error: terminating with uncaught exception of type NSException
Any solutions...
try this code
add this gradle line in you project
compile 'com.twitter.sdk.android:twitter:3.0.0'
Write in your Activity/Fragment
//Your Custom Button
private ivTwitter;
//Twitter Login Button
private TwitterLoginButton ivTwitterMain;
//init twitter
TwitterConfig config = new TwitterConfig.Builder(this)
.logger(new DefaultLogger(Log.DEBUG))
.twitterAuthConfig(new TwitterAuthConfig(Const.CONSUMER_KEY, Const.CONSUMER_SECRET))
.debug(false)
.build();
Twitter.initialize(config);
//find your button
ivTwitter = (ImageView) findViewById(R.id.ivTwitter);
ivTwitterMain = (TwitterLoginButton)findViewById(R.id.ivTwitterMain);
//twitter login callback
ivTwitterMain.setCallback(new Callback<TwitterSession>() {
#Override
public void success(Result<TwitterSession> result) {
// Do something with result, which provides a TwitterSession for making API calls
TwitterSession session = TwitterCore.getInstance().getSessionManager().getActiveSession();
TwitterAuthToken authToken = session.getAuthToken();
String token = authToken.token;
String secret = authToken.secret;
getTwitterUserProfile(session);
}
#Override
public void failure(TwitterException exception) {
// Do something on failure
Log.d(Const.FRAGMENT_REGISTER, exception.getMessage());
}
});
getTwitterUserProfile code
private void getTwitterUserProfile(TwitterSession session) {
AccountService accountService = new TwitterApiClient(session).getAccountService();
Call<User> callback = accountService.verifyCredentials(true, true, true);
callback.clone().enqueue(new Callback<User>() {
#Override
public void success(Result<User> result) {
Log.d("NAME ", result.data.name);
Log.d("EMAIL", result.data.email);
Log.d("PICTURE ", result.data.profileImageUrl);
}
#Override
public void failure(TwitterException exception) {
}
});
}
at last generate Click event of custom button
ivTwitter.setOnClickListener(new View.OnClickListener() {
#Override
public void onClick(View v) {
//twitter login button
ivTwitterMain.performClick();
}
});
I'm assuming that you have already read the twitter official documentation about "Installation" of the TwitterKit in iOS app. I had such experience and the only thing that worked and wasn't in the documentation was this:
In your Info.plist file make sure that "twitterkit-yourAppKey" in
your CFBundleURLSchemes is Item 0.
I've answered this here. Hope it helps you :)

AdColony unity sdk

Hello I have problem with installing AdColony SDK for Unity. I just setup code like in instruction but it still shows that I haven't any ads in my zone. I have no idea if I did something wrong or I forgot to implement something.
public void Initialize()
{
// Assign any AdColony Delegates before calling Configure
AdColony.OnV4VCResult = OnV4VCResult;
// If you wish to use a the customID feature, you should call that now.
// Then, configure AdColony:
AdColony.Configure
(
"version:1.0,store:google",// Arbitrary app version and Android app store declaration.
APPID, // ADC App ID from adcolony.com
zoneID
);
}
public void PlayV4VC(string zoneID, bool prePopup, bool postPopup){
if (AdColony.IsV4VCAvailable (zoneID)) {
Debug.Log ("Video is avaiable!");
} else {
Debug.Log ("Video is NOT avaiable!");
}
}
private void OnV4VCResult (bool success,string name, int amount){
if (success) {
Debug.Log ("Video watched!");
} else {
Debug.Log ("Failed.");
}
}

Get BBM Chat Logs

A Simple question for every one , is there any possible way to get Blackberry BBM Logs in application , via Programming.
Following task I have done :-
Download & integrate BBM SDK in Project.
Follow the BBM Development Guide.
Here are My Code :-
public void getBBM_Logs()
{
BBMPlatformContext platformContext =null;
try
{
platformContext = BBMPlatformManager.register(new MyBBMAppPlugin());
if(platformContext != null)
{
ContactListService contactListService = platformContext.getContactListService();
BBMPlatformContactList contacts = contactListService.getContactList();
Enumeration contactsEnum = contacts.getAll();
while(contactsEnum.hasMoreElements())
{
BBMPlatformContact contact = (BBMPlatformContact)contactsEnum.nextElement();
add(new LabelField(contact.getDisplayName()));
}
}
}
catch (ControlledAccessException e)
{
// The BBM platform has been disabled
}
if (platformContext != null)
{
MyBBMPlatformContextListener platformContextListener;
platformContextListener = new MyBBMPlatformContextListener();
platformContext.setListener(platformContextListener);
}
}
private class MyBBMPlatformContextListener extends BBMPlatformContextListener
{
public void accessChanged(boolean isAccessAllowed, int accessErrorCode)
{
if (!isAccessAllowed)
{
// You cannot access the BBM platform
}
}
public void appInvoked(int reason, Object param)
{
// Code for handling different contexts for invocation
}
}
private class MyBBMAppPlugin extends BBMPlatformApplication
{
public MyBBMAppPlugin()
{
super("57888721-1e52-4171-a8a4-0559eab8efdf");
}
}
Please Let Me know , is there any possible way to get ChatLogs.
Sorry this is not possible - as I think BB regard access to chat logs from a program as a potential security exposure.

Resources