Comments (14)
The issue seems to be coming from Facebook.Unity.dll:
$ grep -r IOSInit .
Binary file ./Plugins/Facebook.Unity.dll matches
Binary file ./Plugins/iOS/Facebook.Unity.IOS.dll matches
./SDK/Editor/iOS/FBUnityInterface.mm: void IOSInit(const char *_appId, bool _frictionlessRequests, const char *_urlSuffix, const char *_userAgentSuffix)
from facebook-sdk-for-unity.
yes ioswrapper with full dll import exists in Facebook.Unity.dll, it must be removed or marked with "#if UNITY_IOS || UNITY_IPHONE"
from facebook-sdk-for-unity.
I can't believe they have not updated it yet! The error is still here with il2cpp. Please fix this error.
from facebook-sdk-for-unity.
actislav, can you elaborate? Because we cannot edit the dll, I wonder if you mean we should edit FacebookPostProcess.cs ?
from facebook-sdk-for-unity.
bosaku, the problem is that when you build for NDK with IL2CPP facebook dlls contain p/invoke to methods which are not linkable to.
Any p/invoke method declaration when compiling to NDK/IL2CPP on android needs to be linkable. So the fix would be either you remove all P/Invoke from Facebook.Unity.dll, move them to the ios dll and have the unitypackage specify the ios dll is not for android or include some sort of stub .so for android so they are linkable.
Update: I am attempting a build right now with all P/Invoke calls stubbed in a .SO for ndk. I'm hesitant to say that it will work, because the module in the dll is __Internal but will let you know.
from facebook-sdk-for-unity.
I attempted to make a .so containing stubbed c functions and it does not work, likely because the p invoke functions use "__Internal" as the module name.
Build failure is here: http://pastebin.com/Wfxc5CAJ
bosaku i think the easiest approach to solve this problem is to first ensure that there are no p/invoke calls in Facebook.Unity.dll, then get rid of Facebook.Unity.IOS.dll entirely in preference to moving the single class in the dll to a .cs in a plugins dir that ifdefs out the pinvoke calls. You'd have to look up the class via Assembly-CSharp first pass, but could alternately use initialize on load from the script into the api. As it is right now, it seems the only way to get it to compile (even if you set Facebook.Unity.IOS.dll as not included on android) is to manipulate the dll to remove the p/invoke (or use a earlier version).
All in all with the current facebook sdk i've been pretty upset. First my iOS builds did not work because the facebook frameworks packaged with unity sdk are incompatible with xcode 7.2 so I had to manually replace the frameworks with ones from january 2016 just to get it to build, and now i cannot get android to work without significant effort. Does facebook even test all the platforms?
I'm retrying the so fix after renaming the .so to lib__Internal.so heres the source but again am not positive it will work http://pastebin.com/GArDhXvq . if this doesn't work i'll be required to either manipulate the dll to use a different module name
Update: the lib__Internal.so fix did not work. And while running reflexil i noticed that Facebook.Unity.IOSWrapper is the main offender (as said by actislav) of this issue (as its located in Facebook.Unity.dll not Facebook.Unity.IOS.dll ). Of course it should be noted that the unity package should have also set Facebook.Unity.IOS.dll as iOS / tvOS only. Either way, the reason everyone is running into this beyond those who took the extra step to mark Facebook.Unity.IOS.dll as iOS only is because these are not linkable. I've used reflexil to neutralize IOSWrapper and am building now, Im' assuming it will finish building but if it does not I will let you know.
While awaiting the long process that is Android IL2CPP NDK builds, I made a pull request here #35
Once it does build, it does fatal crash when ran. I've put a new issue up detailing the issue.
from facebook-sdk-for-unity.
@bblpny: Does your pull request resolve this issue ?
from facebook-sdk-for-unity.
nhatnd, yes but I haven't tested iOS yet. Facebook doesn't have Facebook.Unity.IOS and Facebook.Unity.Android projects on github for some reason. And you'll need at least Facebook.Unity.IOS.dll, but its possible IL2CPP may strip the dll when building for iOS.
Note: you'll also need to set Facebook.Unity.IOS.dll to not be included in android builds.
from facebook-sdk-for-unity.
@bblpny: But could you please let me know how to modify the Facebook.Unity.dll ? Or could you give me the dll with your modification ?
Thank you very much.
from facebook-sdk-for-unity.
I tried to download the facebook source and apply bblpny's fix then rebuild it. It can be built now. Hope facebook will make the official fix for this soon.
from facebook-sdk-for-unity.
@nhatnd , glad you got it working. Josh has just told me that the fix should be in upcoming 5.4.2p2
from facebook-sdk-for-unity.
I'm pretty confused by this conversation.
What would I do with the code snippet on pastebin? I don't see a file to replace with a similiar structure.
I tried downloading, and compiling your source in git which fixes the IL2CPP errors, but I receive errors when running ./setup.sh -> FATAL: Failed to copy '/Users/StreamfallMobile/Library/Android/sdk/extras/android/m2repository/com/android/support/support-v4/23.4.0/support-v4-23.4.0.aar'
Any other guidance?
Thank you!
from facebook-sdk-for-unity.
+1 on a fix for this, experiencing the same issue and it will force us to remove Facebook from our Android game.
from facebook-sdk-for-unity.
Just as a follow-up, the 5.4.2p3 patch only fixes the issue after you remove the references to the IOS pinvoke functions.
So,for those that just want to get android to work i've attached the patched dll that excludes the unlinkable ios pinvoke calls that prevent android il2cpp builds from completing.
To admistrators: If i am breaking any rules by posting this dll please remove the attachment.
Please follow the steps below
Ensure the following:
- You are running the patch release of unity version 5.4.3p (perhaps 5.3.2p will work as well)
- You are using 7.8.0 facebook sdk for unity.
- You either have unity closed before preceeding or will not focus to it while doing the following steps.
Make a backup:
- Copy the file Facebook.Unity.dll located in Assets/FacebookSDK/Plugins to any folder outside (not within) the Assets folder. (Important if you support iOS and Android)
Extract and replace:
- Extract Facebook.Unity.Patched.Patched.dll from the attached zip file to the same directory inside of Assets that you made a backup of Facebook.Unity.dll
- Delete only Facebook.Unity.dll, Do not delete Facebook.Unity.dll.meta if it exists!
- Rename Facebook.Unity.Patched.Patched.dll to Facebook.Unity.dll
Open or focus to unity:
- Unity will import the dll, but as long as you did not focus to unity between these steps all asset bindings to monobehaviours or scriptable objects within the facebook dll will retain their references.
- Build the Android IL2CPP project.
Because this requires that you replace the dll, it breaks iOS support. So in order to build for iOS after this, you need to do the following, under the same restrictions of not focusing or having unity open:
- Delete the Facebook.Unity.dll that you previously renamed from Facebook.Unity.dll
- Restore the original Facebook.Unity.dll that you backed up previously.
- Open unity and build.
Notes about the patch: Reflexil and ILSpy were used to do the following:
- Within the internal problematic class Facebook.Unity.IOSWrapper all static pinvoke methods had the following attributes removed so that they were no longer checked:
Method Impl: IsPreserveSig
IsPInvokeImpl
Then saved as Facebook.Unity.Patched.dll - Secondly, to the first patched version, each of the void returning methods were given opcodes to just return:
0(offset) ret
and the one string returning method IOSFBSdkVersion given following opcode to return null:
0(offset) Idnull
1(offset) ret
then this was saved off to Facebook.Unity.Patched.Patched.dll
Facebook.Unity.Patched.Patched.zip
from facebook-sdk-for-unity.
Related Issues (20)
- Android 34 / FB SDK - can't build ( A failure occurred while executing com.android.build.gradle.internal.tasks.Workers$ActionFacade ) HOT 21
- Login from developer account HOT 1
- Feature Request: Request Newest Facebook SDKv17.0.0 for unity HOT 9
- Facebook SDK does not work with Unity 2023 HOT 2
- Feature Request: malloc deallocate buffer in iOS SDK
- iOS Graph API Calls using FB.API Fail in 17.0.0 HOT 4
- 17.0 build failed HOT 9
- With Apple ATT refused by user, Facebook classic login fallback in a limited login and returns a non valid authentication token HOT 15
- Confuse about version is latest and use in unity.
- Graph Api Bad Signature IOS
- How to add user_friends permission?
- 17.0 Limint login Error
- [IOS] Unity Crashes on Startup in [FBSDKInternalUtility validateAppID] + 132 (FBSDKInternalUtility.m:451) HOT 2
- Feature Request: In SDK facebook app Id and Client Token not have any validation.
- ERROR: Failed to start login flow,InnerErrorCode: 190,InnerErrorMessage: Error validating application. Invalid application ID.,InnerErrorSubcode: 0,InnerErrorTraceId: HOT 2
- Feature Request: Expose the token issue and expiry.
- State of development
- Facebook asks users to continue using previously logged-in credentials each time they use the WebGL app.
- [Question/Feature] If XUPorter is deprecated, can you remove XUPorter's projectmods file from SDK
- [Feature] Could you please give us an example for AuthenticationToken Validation in Python
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from facebook-sdk-for-unity.