Closed NumaNumaNuma closed 5 years ago
Great, thanks
Hi @oct-test @sharonreytan , sorry for the late reply. I will investigate the issue and will reply to you as fast as possible. Do you have the same exception as Uncaught exception: NSInvalidArgumentException: +[NSError fbErrorWithCode:userInfo:message:underlyingError:]:
? Can you upload a sample project if possible?
Thanks for your comments and help in this issue!
@KylinChang Yeah, that is the error. I want to help you get to the issue - it happens on iOS > 12.1.4, on Facebook SDK for Unity 7.15.1. On an iPhone -ObjC solved this issue. On iPads the error persists on wifi. Some of us experienced it for cellular. It happens on load, before we get to call FB.Init(). I will upload a sample project soon. Thank you for reopening the issue
https://drive.google.com/open?id=1aLdPTQyiqpCJf1bMyOGjLeOPg2D8NjZx
Sorry it's not on git. It is a simple project with a cube, particles system and Facebook SDK 7.15.1 integrated to my app ID. Notice that the Unity project is with my app's bundle name. Change it as you wish. Unity version is 2018.3.3.
What version should we use in the mean time?
@elguero44 did you add the -ObjC flag? I guess Apple missed with your app. It seems to happen even on the simplest project. It is something on the FBSDK for Unity. My previous game was also approved and released but I see that there are crashes on iPads. It also had the FBSDK
No I haven't added ObjC flag. Weird though that this would swap the behaviour...
@elguero44 No, it solves the error on my iPhone. Try it. I can't test on an iPad but for that Apple rejects me. I think that for now I will release only for iPhones until the issue is fixed. I'll keep you updated if Apple will approve or reject it
No I haven't added ObjC flag. Weird though that this would swap the behaviour...
From what I've seen It happens on either wifi / 3G depending on which one is slower / faster where you are. And definitely add the objC flag, it fixed it for me a few months ago but now with all those recent posts I'm worried the problem is back with the new iOS / XCode. Waiting on more info from KylinChang 👍
I think it has something to do with the velocity of the internet connection? Because suddenly sometimes on data it works too...
@KylinChang I have attached the crash report.
@sharonreytan By any chance, do you have a space after your app ID in the fb SDK edit settings panel? I found that I had one there by accident, after I removed it, the problem was fixed, even without the -ObjC flag. I will leave the ObjC flag there just in case.
@happypepper Oh no if it is the issue I will feel so bad... I will check this asap. I don't think this is the case because I copied from the Facebook for Developers site by click, but everything is possible.. Did you check it on wifi, cellular and flight mode and everything was fine? Did it crash only on iOS? on which iOS version did it happen?
I also copy pasted from FB developer site, but somehow the space was included. I tried wifi and cellular but not flight mode, they were both fine. With the space, it was breaking on cellular but fine on wifi. I've only been testing on 12.1.2
@happypepper thank you so much for writing this, I will check if that's the case. Hopefully that's the issue
@happypepper No extra spaces in the app id. Still crashes.
hard to explain how it solved the issue for that day. Maybe the wifi was bad and it worked for my testers and I. Please ignore this, the error persists
@happypepper How can I send you some flowers???? You solved my issue!!!! Thanks!! @oct-test @elguero44 @pmusolino I had a space in my app name, I removed it. Boom. Everything works well even without the -ObjC flag.. I'm on the same wifi, same device, same os, same fbsdk with GameAnalytics on unity, same unity, same Xcode, same project... It was the only change I made and now it works like a charm every single launch...
I had the same issue with sdk 7.15.1 The problem seems to be in the FBUnityInterface.mm file at this line 114: [FBUnityUtility sendMessageToUnity:FBUnityMessageName_OnInitComplete userData:userData requestId:0];
if i comment this line out, everything works without crash
@happypepper How can I send you some flowers???? You solved my issue!!!! Thanks!! @oct-test @elguero44 @pmusolino I had a space in my app name, I removed it. Boom. Everything works well even without the -ObjC flag.. I'm on the same wifi, same device, same os, same fbsdk with GameAnalytics on unity, same unity, same Xcode, same project... It was the only change I made and now it works like a charm every single launch...
@sharonreytan Congratulations! Thank you @happypepper. I will investigate further on the reason and will add warning or fix the issue in the next release.
@KylinChang thanks! Let's validate that everyone's errors with this issue got to solve it as well. I really hope so
@sharonreytan Glad to be of help!
No extra spaces in the app id. Still crashes.
So @oct-test no extra space + objC flag still doesn't do it for you?
@NumaNumaNuma @sharonreytan @KylinChang No extra space in the app id + objC flag = issue not resolved
I am able to see the in-game events in the Facebook Analytics dashboard. In my case, the build randomly crashes when the code tries to send an event.
@oct-test try to change your app name to a single word, something like "production", remove the client token, copy the app id again and make sure that there are no spaces in the beginning and in the end. Make sure that your event messages have no spaces. Make sure that your iOS bundle ID is correct on the Facebook for Developers dashboard > settings > basic. In my case the crash was on load, now it runs well even without this -ObjC flag, but I don't send events to fb. Only initialize it. Does the game crash on load, or crashes in-game when you send an event?
@sharonreytan
@oct-test
Thank you for the explanation.
Were you able to reproduce the issue 100% times? If yes, what type of device (model and iOS version) and network connection you were testing the build?
@oct-test
I didn't need the -ObjC flag anymore, ran the game on simulators and sent a test flight to friends. It works perfectly on their devices, with wifi or cellular or flight mode. On my iPhone 8 it runs smoothly as well. Beforehead the game crashed immediately on load without the -ObjC flag on wifi. Now everything runs as expected
@KylinChang @oct-test My celebration was too early. The game has been rejected for the same reason -
On iPad running iOS 12.2 on wifi the game crashed
Better apple catching it than your users (that's what happened to me). If you can do without, temporarily, there's also the option of completely removing the sdk. I'll be holding out on my releases until this is fixed.
For sure. Do you think I can release to iPhones only? I can't give up on the sdk. @NumaNumaNuma
Risky :)
Holding out on your release is not a solution. It seems that this problem exists for a long time now. At least 2 years. We went through all releases since 2017 and the problem is the same. There must be another solution that some devs accidentally do in order to not get the crashes.
For me as soon as I added the objC flag everything has been fine, for months. But it seems the problem is back, maybe because of the new iOS?
I actually realized that I have objC flag in my project all along. And still have the problem. I also checked back my older projects and I see that after doing an update to fb sdk 4.38 just recently my crash rate went down significantly. I'm doing a test right now with unity version 7.14.1 that has this version of fb sdk included. Will report back. We also moved the initialization to the start method (from the awake method).
Question: can we update manually in Xcode to the latest FB SDK, replacing the one that comes with Unity SDK? Anyone has tried that?
For me as soon as I added the objC flag everything has been fine, for months. But it seems the problem is back, maybe because of the new iOS?
I'm using ios 12.1.4 on the device I registered myself the problem. Unity version used is: 2018.2.9
@elguero44 did anything you try solved this? I noticed that when the internet's downstream Mb/s is low it doesn't crash mostly
I reopened the issue on Facebook: https://developers.facebook.com/support/bugs/2313553335596878/?disable_redirect=0
@oct-test @elguero44 @NumaNumaNuma @pmusolino and everyone else that experiences this, Please mark the "same here" flag
done 👍
Don't know if that has anything to do with it, but I noticed sometimes the LSApplicationQueriesSchemes values are not being added to the info.plist file. Maybe if they're missing and the sdk is trying to call them, it causes problems? I logged this as a separate issue but maybe they're related.
"fbapi", "fb-messenger-api", "fbauth2", "fbshareextension"
I reopened the issue on Facebook: https://developers.facebook.com/support/bugs/2313553335596878/?disable_redirect=0
@oct-test @elguero44 @NumaNumaNuma @pmusolino and everyone else that experiences this, Please mark the "same here" flag
Done.
Don't know if that has anything to do with it, but I noticed sometimes the LSApplicationQueriesSchemes values are not being added to the info.plist file. Maybe if they're missing and the sdk is trying to call them, it causes problems? I logged this as a separate issue but maybe they're related.
"fbapi", "fb-messenger-api", "fbauth2", "fbshareextension"
Can you please post the Facebook Bug Tracker link here?
https://github.com/facebook/facebook-sdk-for-unity/issues/229
I just logged it here on github
Don't know if that has anything to do with it, but I noticed sometimes the LSApplicationQueriesSchemes values are not being added to the info.plist file. Maybe if they're missing and the sdk is trying to call them, it causes problems? I logged this as a separate issue but maybe they're related.
"fbapi", "fb-messenger-api", "fbauth2", "fbshareextension"
In my Xcode project, all those schemes are present but the problem still persist. @NumaNumaNuma anything else I should look into?
@KylinChang we are looking for some help from you. Please let us know the progress made on the bug resolution by the Facebook team. Thank you.
@KylinChang @NumaNumaNuma @sharonreytan Do you know how can we integrate the FB iOS SDK version 4.40 (latest FB iOS SDK) in this Unity version?
Current version of Unity FB SDK (v7.15.1) uses FB iOS SDK version 4.39.1.
The changelog here suggest that there are few bug fixes in the latest FB iOS SDK.
@oct-test also this version presents the issue.
Hey all, you can change SDK version by following steps: 1. change the version in scripts/build.properties 2. run ./scripts/setup.sh && ./scripts/build.sh. Open project UnitySDK and then export the package.
@pmusolino Facebook iOS SDK 4.40 has this issue?
Hello all,
On my end, the frequency of this crash issue in very low. I am thinking to release my game and try my luck.
I wanted to know if any other developer here got his/her game approved from Apple? If yes, are there any user complaints about the crash? What's the frequency of the crash on the users' end?
Thank you.
@oct-test I wouldn't take the risk of releasing. On my wifi the crash happens every launch. You don't want users to give you bad reviews for these crashes, you put too much effort in it to be scored badly for crashes. People write bad reviews faster than they write good reviews. I decided to wait for a resolution before my release (a fix or a workaround, but stabilization is a must...)
I decided to release the app anyway, so far so good no crashes. just in case it helps, this is how I'm initializing the sdk (nothing special there but who knows maybe for those who have crashes on launch...):
private void Awake()
{
InitFBSDK();
}
private void InitFBSDK()
{
if (!FB.IsInitialized)
{
FB.Init(InitCallback);
}
else
{
// Already initialized, signal an app activation App Event
FB.ActivateApp();
}
}
public void InitCallback()
{
if (FB.IsInitialized)
{
// Signal an app activation App Event
FB.ActivateApp();
}
else
{
Debug.Log("Failed to Initialize the Analytics SDK");
}
}
private void OnApplicationPause(bool pauseStatus)
{
if (!pauseStatus)
{
if (FB.IsInitialized)
{
FB.ActivateApp();
}
else
{
FB.Init(InitCallback);
}
}
}
I'm using the sdk for analytics only. I'm getting rare crashes on app launch for some of our users (Unity 2018.2.19 and iOS 12.1) on 4G only (works fine on wifi). Xcode crash logs show:
At first I thought it was due to FB not being initialized properly but I'm using
private void Awake() { if (FB.IsInitialized) { FB.ActivateApp(); } else { FB.Init(FB.ActivateApp); } }
And I check that FB has been initialised before logging any analytics event.Not sure if I'm doing something wrong or if this is a bug. Would love some feedback either way.
Thanks!