Bug 11041 - Project that uses facebook sdk bindings terminates after startup on iOS < 6.0
Summary: Project that uses facebook sdk bindings terminates after startup on iOS < 6.0
Status: RESOLVED NOT_ON_ROADMAP
Alias: None
Product: iOS
Classification: Xamarin
Component: Xamarin.iOS.dll ()
Version: 6.2.x
Hardware: Macintosh Mac OS
: --- normal
Target Milestone: Untriaged
Assignee: Bugzilla
URL:
Depends on:
Blocks:
 
Reported: 2013-03-11 09:59 UTC by folex
Modified: 2017-01-05 16:29 UTC (History)
13 users (show)

Tags:
Is this bug a regression?: ---
Last known good build:


Attachments
Sample project. (9.39 KB, application/zip)
2013-03-11 09:59 UTC, folex
Details
iPhone simulator crash report (44.27 KB, application/octet-stream)
2013-03-11 10:00 UTC, folex
Details
Facebook.dll (1.22 MB, application/x-7z-compressed)
2013-03-13 01:15 UTC, folex
Details
make output (691.65 KB, text/plain)
2013-03-14 08:07 UTC, folex
Details
Test project (10.10 KB, application/zip)
2013-05-20 08:36 UTC, Maxim
Details


Notice (2018-05-24): bugzilla.xamarin.com is now in read-only mode.

Please join us on Visual Studio Developer Community and in the Xamarin and Mono organizations on GitHub to continue tracking issues. Bugzilla will remain available for reference in read-only mode. We will continue to work on open Bugzilla bugs, copy them to the new locations as needed for follow-up, and add the new items under Related Links.

Our sincere thanks to everyone who has contributed on this bug tracker over the years. Thanks also for your understanding as we make these adjustments and improvements for the future.


Please create a new report on Developer Community or GitHub with your current version information, steps to reproduce, and relevant error messages or log files if you are hitting an issue that looks similar to this resolved bug and you do not yet see a matching new report.

Related Links:
Status:
RESOLVED NOT_ON_ROADMAP

Description folex 2013-03-11 09:59:23 UTC
Created attachment 3569 [details]
Sample project.

When I use any class from MonoTouch.FacebookConnect namespace, application fails to start with the following output:
"Starting iOS simulator 5.1
Launching application
Application launched. PID = 23646

Application Terminated"

Same thing happens on device, but not every time.

Crash report says:
"Dyld Error Message:
  Symbol not found: _ACFacebookAppIdKey
  Referenced from: /PathToApp/FacebookTest.app/FacebookTest
  Expected in: /PathToFrameWork/Accounts.framework/Accounts"

I've googled solution: make Account framework optional in xcode. 
I've checked: it is optional by default in local facebook-ios-sdk XCode project and also marked as WeakFramework in AssemblyInfo.cs.
Comment 1 folex 2013-03-11 10:00:26 UTC
Created attachment 3570 [details]
iPhone simulator crash report
Comment 2 Rolf Bjarne Kvinge [MSFT] 2013-03-11 19:28:44 UTC
Which version of MonoTouch are you using? Can you get the complete version information from Xamarin Studio (in the menu find About Xamarin Studio, and here you will see the complete version information).

I tried your project with the facebook binding here: https://github.com/mono/monotouch-bindings/tree/master/facebook - and I couldn't reproduce the problem you're having, so can you attach your binding library too?
Comment 3 folex 2013-03-13 01:15:14 UTC
Created attachment 3590 [details]
Facebook.dll

Version information:
Xamarin Studio Version 4.0.1 (build 9)
Mono 2.10.11 (mono-2-10/2baeee2)
Xamarin.iOS Version: 6.2.0.65 (Business Edition)
Xcode 4.6 (2066) Build 4H127
Comment 4 Rolf Bjarne Kvinge [MSFT] 2013-03-13 07:29:43 UTC
I can reproduce the problem with that binding dll (but I can't when I build my own from monotouch-bindings/facebook/binding) - this indicates that the problem is with the native library embedded in the binding assembly. I checked the sizes, and there is something strange: my libFacebookSDK.a is 1.8MB, while yours is 9.5MB - how did you get/create your binding assembly?
Comment 5 folex 2013-03-14 08:07:15 UTC
Created attachment 3613 [details]
make output

This is really strange.
All I've done is just 
$ cd monotouch-bindings/facebook
$ make
Maybe you'll see some difference between our make's output.
Comment 6 Rolf Bjarne Kvinge [MSFT] 2013-03-14 10:53:34 UTC
I found out the difference: I was building an older version of the facebook-ios-sdk repo. I updated it and now I get the same problem.

The facebook-ios-sdk hash I used (and which worked) was: af2fc3b

I also found the bug in Xamarin.iOS and fixed it - it will be included in the 6.2.2 release. Can you use an older version of the facebook sdk in the meantime?

master: b6d021e495b5e0349a6094a79e12f0d93c40d621
Comment 7 folex 2013-03-14 11:53:03 UTC
Yes, I can. 
Can you please describe the bug you found in Xamarin.iOS? Just curious.
Thanks a lot.
Comment 8 Rolf Bjarne Kvinge [MSFT] 2013-03-14 19:28:27 UTC
The bug I found was that when we calculate the frameworks to link with, we prefer to link normally instead of doing a weak link. In this particular case we determined that the app needs to link with the Accounts framework, and when the binding (also) states that it needs to weak link the Accounts framework we would ignore that and just link.
Comment 9 Pavel Zak 2013-04-12 11:01:54 UTC
Hi,

I am having the same issue and I do not know if this is just simulator problem or something in xamarin.
Unfortunately, I do not have ios5 device to double check it.

I only know, that facebook.dll worked well in my previous app versions (cca month ago) and since then I only updated Xamarin studio....

Currently I have:

Xamarin Studio Version 4.0.3 (build 13)
Runtime:
	Mono 2.10.12 (mono-2-10/c9b270d)
	GTK 2.24.16
	GTK# (2.12.0.0)
Xcode 4.6.1 (2067)

Xamarin.iOS Version: 6.2.3.0 (Business Edition)

Thanks for any hint
Comment 10 Pavel Zak 2013-04-14 07:58:34 UTC
well, I needed to downgrade xamarin.ios to 6.2.2 to make it work...
Comment 11 folex 2013-04-15 07:31:00 UTC
Pavel, so now it works for you with Xamarin.iOS 6.2.2 on last facebook-ios-sdk version from git? And doesn't on 6.2.3?
Comment 12 Mart Roosmaa 2013-04-16 11:30:07 UTC
I'm also running into this issue. I'm using the simulator, don't have a iOS 5 device around to test it with.

Tested with two Xamarin.iOS versions, both of which has this problem:
- 6.2.3.0 (Business Edition)
- 6.2.2.8 (Business Edition)

Facebook SDK is built from latest monotouch-bindings sources.

Can we reopen this bug? Any workarounds?
Comment 13 ohad 2013-04-18 09:05:16 UTC
Where can I find the dll for this facebook-ios-sdk hash I used (and which worked) was: af2fc3b?
Comment 14 folex 2013-04-22 03:57:46 UTC
ohad, you can build it yourself (checkout needed commit and build as always), or I can send you one via email.
Comment 15 Rolf Bjarne Kvinge [MSFT] 2013-04-24 18:41:52 UTC
Xamarin.iOS 6.2.2 and 6.2.3 only fixed a few critical bugs, so the fix for this bug hasn't been released yet.

At this point I do not know exactly which version will include this fix.
Comment 16 ohad 2013-04-25 03:21:44 UTC
folex, I will be happy if you could send it to me at ohad8321@gmail.com .

Do you know if this version of the facebook SDK has the Extend token method?
Because this is my main problem. I can't find an a working dll that doesn't havethe bug we are talking about and includes the extend token method which is really important to implement if you don't want you facebook token to expire. 

Thanks so much!
Comment 17 Alexandre Chohfi 2013-05-06 10:16:35 UTC
When will this fix(6.2.2) be available at the Xamarin Store?
Comment 18 Rolf Bjarne Kvinge [MSFT] 2013-05-08 06:02:57 UTC
If everything goes as currently planned, the fix will be in 6.2.5 which will be released within a week or so.
Comment 19 canab 2013-05-15 05:41:46 UTC
I stil have an issue.
I rebuilt facebook dll from the latest sources.

Xamarin.iOS
Version: 6.2.5.2 (Business Edition)
Mono 2.10.12 (mono-2-10/c9b270d)
Xcode 4.6.1 (2067)
Comment 20 canab 2013-05-16 07:14:52 UTC
I am finally able to launch app on iOS 5.1 device.
Target version 4.3 should be specified in app's Info.plist (SDK version is 6.1)
For TargetVersion = 5.0 or 5.1 linker error occurs:
Symbol not found: _ACFacebookAppIdKey
Comment 21 Maxim 2013-05-20 04:01:15 UTC
@Rolf, is the fix included into 6.2.5+ versions of MonoTouch? For our project this issue became critical.
Comment 22 Rolf Bjarne Kvinge [MSFT] 2013-05-20 06:55:34 UTC
@Maxim: can you attach a project that reproduces the issue? I cannot reproduce this issue with the project the original reporter attached and MonoTouch 6.2.5+.
Comment 23 Maxim 2013-05-20 07:18:40 UTC
#Rolf: now I couldn't attach project. Did you try latest version with new lib name "MonoTouch.FacebookConnect.dll"?
Comment 24 Rolf Bjarne Kvinge [MSFT] 2013-05-20 07:24:18 UTC
@Maxim: I updated and built github.com:mono/monotouch-bindings/facebook/bindings today, and used the dll produced there.

If bugzilla doesn't allow you to upload it, it's likely because it's too big (in which case you can use dropbox or a similar service).
Comment 25 canab 2013-05-20 07:36:13 UTC
Maybe reproducing is related to "Target version" specified in Info.plist?
As I wrote, In our project bug is reproducable if target version = 5.0/5.1 and is not reproducing if target version is 4.3
Comment 26 Maxim 2013-05-20 07:40:12 UTC
@Rolf: I couldn't upload project due to NDA and money penalties :)

I understood what you're saying. If start a new project, add dll to reference, it's OK - app successfully running on iOS 5.X device.

Now the task is to find difference between test project and our main app.
Comment 27 Maxim 2013-05-20 08:31:09 UTC
Hm, it was older version of Facebook iOS SDK - 3.0.8. No issues with that version.

For the latest version:
iOS 5.1 device - crash;
iOS 5.0 simulator - crash.

When tried to use @canab method (set target to 4.3):
iOS 5.1 device - ok;
iOS 5.0 simulator - ok.
Comment 28 Maxim 2013-05-20 08:36:25 UTC
Created attachment 3992 [details]
Test project

It works with old (3.0.8) library OR when target version is 4.3.
It doesn't work with latest (3.5.1) library and target version 5.0.

All correct both for simulator and device.
Comment 29 Maxim 2013-05-20 08:37:42 UTC
Real appId was replaced in code (const string AppId) and twice in Info.plist.
Comment 30 folex 2013-05-20 08:40:16 UTC
For me everything works like @Maxim said:
Crash on the latest version.

Also, there is also critical problem with older (3.0.5b SHA-1: af2fc3b) version: after building dll, I can find private api method "setUrlRequest:":
$ strings MonoTouch.FacebookConnect.dll  | grep -i seturlrequest
selSetUrlRequest_
selSetUrlRequest_Handle
setUrlRequest:

But facebook-ios-sdk of this version doesn't have this function (while latest version does), at least:
1. I can't find it in source code
2. I can't find it in statis .a libraries 
Only in .dll. So, if you could, please, point out where this came from.

Thank in advance.
Comment 31 canab 2013-05-31 04:28:59 UTC
It seems issue is finally fixed in the last update
Comment 32 ogborstad 2013-06-10 14:54:15 UTC
canab: what is your setup when you say that it seems fixed?

I am on Xamarion.iOS 6.2.7, Facebook SDK 3.2, latest build of Monotouch-bindings

It does not work on iOS5 with target version 5.0
Comment 33 canab 2013-06-10 15:56:27 UTC
Monotouch bindings:
commit 297eb2804e01b2ed62a440b03b8f8b3a8dde58b7

Facebook API:
Facebook iOS SDK 3.5.1
git commit: 06effac2a044ef97fc7037d9814a363a46b55d71

Xamarin configuration:

Xamarin Studio
Version 4.0.8 (build 2)
Installation UUID: 12888312-f7f9-4276-91ec-fae91acc8cd1
Runtime:
	Mono 2.10.12 (mono-2-10/c9b270d)
	GTK 2.24.16
	GTK# (2.12.0.0)
	Package version: 210120000

Apple Developer Tools
Xcode 4.6.1 (2067)
Build 4H512

Xamarin.iOS
Version: 6.2.6.6 (Business Edition)
Hash: 991f45c
Branch: 
Build date: 2013-23-05 20:11:20-0400
Comment 34 Sebastien Pouliot 2017-01-05 16:29:27 UTC
Those bindings are not ship with XI and are out-of-date.