Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 12 Next capture
2021 2022 2023
1 capture
12 Jun 22 - 12 Jun 22
sparklines
Close Help
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
  • Asset Store
  • Get Unity

UNITY ACCOUNT

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account
  • Blog
  • Forums
  • Answers
  • Evangelists
  • User Groups
  • Beta Program
  • Advisory Panel

Navigation

  • Home
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
    • Blog
    • Forums
    • Answers
    • Evangelists
    • User Groups
    • Beta Program
    • Advisory Panel

Unity account

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account

Language

  • Chinese
  • Spanish
  • Japanese
  • Korean
  • Portuguese
  • Ask a question
  • Spaces
    • Default
    • Help Room
    • META
    • Moderators
    • Topics
    • Questions
    • Users
    • Badges
  • Home /
avatar image
1
Question by fullmontag · Oct 05, 2016 at 06:21 PM · iosfacebook

Unity 5.5 and Facebook SDK not working well together in iOS

I recently upgraded to unity 5.5 and facebook sdk 7.8.0. Since i did this fb login in iOS fails in UnityAppController.mm, in this function:

 - (BOOL)application:(UIApplication*)application openURL:(NSURL*)url sourceApplication:(NSString*)sourceApplication annotation:(id)annotation
 {
     NSMutableArray* keys    = [NSMutableArray arrayWithCapacity:3];
     NSMutableArray* values    = [NSMutableArray arrayWithCapacity:3];
 
     auto addItem = [&](NSString* key, id value)
     {
         [keys addObject:key];
         [values addObject:value];
     };
 
     addItem(@"url", url);
     addItem(@"sourceApplication", sourceApplication);
 //FAILS ON THE FOLLOWING LINE BECAUSE annotation IS NULL
     addItem(@"annotation", annotation);
 
     NSDictionary* notifData = [NSDictionary dictionaryWithObjects:values forKeys:keys];
     AppController_SendNotificationWithArg(kUnityOnOpenURL, notifData);
     return YES;
 }

If i comment out the line that tries to add "annotation" variable to the array it works fine. Login in android works fine.

Anyone know how to fix this or work around it without having to manually edit the file?

Comment
Add comment
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users

4 Replies

· Add your reply
  • Sort: 
avatar image
9

Answer by Frank84 · Dec 02, 2016 at 02:07 AM

This is still an issue with Unity 5.5.0f3 and Facebook SDK 7.9.0. I fixed it by replacing the method with the older version for now just in case the "annotation" key is actually used for something.

 - (BOOL)application:(UIApplication*)application openURL:(NSURL*)url sourceApplication:(NSString*)sourceApplication annotation:(id)annotation
 {
     NSMutableArray* keys    = [NSMutableArray arrayWithCapacity:3];
     NSMutableArray* values    = [NSMutableArray arrayWithCapacity:3];
 
     #define ADD_ITEM(item)    do{ if(item) {[keys addObject:@#item]; [values addObject:item];} }while(0)
 
     ADD_ITEM(url);
     ADD_ITEM(sourceApplication);
     ADD_ITEM(annotation);
 
     #undef ADD_ITEM
 
     NSDictionary* notifData = [NSDictionary dictionaryWithObjects:values forKeys:keys];
     AppController_SendNotificationWithArg(kUnityOnOpenURL, notifData);
     return YES;
 }
Comment
Add comment · Show 6 · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image voporak5 · Dec 12, 2016 at 03:24 PM 0
Share

you're a lifesaver

avatar image JoseGuya · Dec 14, 2016 at 08:36 PM 0
Share

You just ended my misery today, sir.

avatar image AVOlight · Dec 20, 2016 at 12:00 AM 0
Share

Thank you Frank!

avatar image agil · Jan 05, 2017 at 03:27 AM 0
Share

thank you frank, it works.

avatar image dave_oak · Jan 05, 2017 at 11:59 AM 0
Share

Thanks so much!

Show more comments
avatar image
1

Answer by ubberkid · Jan 21, 2017 at 06:51 AM

https://unity3d.com/unity/qa/patch-releases

Theres Patch 5.5.0p4 that addresses this issue (:

(856989) - iOS: Fixed crash in application:openURL:sourceApplication:annotation due to missing null check with Facebook SDK.

Comment
Add comment · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image
0

Answer by Emmanuel_Charon · Dec 20, 2016 at 09:55 PM

This fix was also posted here: https://developers.facebook.com/bugs/900542723380664/?__mref=message_bubble (by Jing Liao) and worked for me. Just add 2 files in the unity project, rebuild, and it works.

Comment
Add comment · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image
0

Answer by GeekCats · Jun 12, 2017 at 02:36 PM

I am in Unity 5.6.1f1 and Facebook SDK 7.9.4 and i am getting this error when sharing. Also Logins keeps re-asking on every app opening. (IOS and Android app) Can somebody help me please? alt text


errofacebook.png (49.4 kB)
Comment
Add comment · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users

Your answer

Hint: You can notify a user about this post by typing @username

Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.

Follow this Question

Answers Answers and Comments

14 People are following this question.

avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image

Related Questions

Why the feed stories of my facebook game attempt to open the canvas instead of launch the Android/iOS mobile application? 1 Answer

Facebook - Is it possible to logout other active sessions? 0 Answers

Xcode hook up with Unity 1 Answer

Facebook App Submit For Review Suggestion 0 Answers

FB.INIT is failing while building for iOS. 2 Answers


Enterprise
Social Q&A

Social
Subscribe on YouTube social-youtube Follow on LinkedIn social-linkedin Follow on Twitter social-twitter Follow on Facebook social-facebook Follow on Instagram social-instagram

Footer

  • Purchase
    • Products
    • Subscription
    • Asset Store
    • Unity Gear
    • Resellers
  • Education
    • Students
    • Educators
    • Certification
    • Learn
    • Center of Excellence
  • Download
    • Unity
    • Beta Program
  • Unity Labs
    • Labs
    • Publications
  • Resources
    • Learn platform
    • Community
    • Documentation
    • Unity QA
    • FAQ
    • Services Status
    • Connect
  • About Unity
    • About Us
    • Blog
    • Events
    • Careers
    • Contact
    • Press
    • Partners
    • Affiliates
    • Security
Copyright © 2020 Unity Technologies
  • Legal
  • Privacy Policy
  • Cookies
  • Do Not Sell My Personal Information
  • Cookies Settings
"Unity", Unity logos, and other Unity trademarks are trademarks or registered trademarks of Unity Technologies or its affiliates in the U.S. and elsewhere (more info here). Other names or brands are trademarks of their respective owners.
  • Anonymous
  • Sign in
  • Create
  • Ask a question
  • Spaces
  • Default
  • Help Room
  • META
  • Moderators
  • Explore
  • Topics
  • Questions
  • Users
  • Badges