1

当我尝试构建 facebook API 的 monotouch-binding 示例时,出现以下错误:

Building: sample (Debug|iPhoneSimulator)
Performing main compilation...
/Developer/MonoTouch/usr/bin/smcs /noconfig "/out:/Users/kovacsd/devel/mozdulj/Libraries/monotouch-bindings/facebook/sample/bin/iPhoneSimulator/Debug/sample.exe" "/r:/Developer/MonoTouch/usr/lib/mono/2.1/System.dll" "/r:/Developer/MonoTouch/usr/lib/mono/2.1/System.Xml.dll" "/r:/Developer/MonoTouch/usr/lib/mono/2.1/System.Core.dll" "/r:/Developer/MonoTouch/usr/lib/mono/2.1/monotouch.dll" "/r:/Users/kovacsd/devel/mozdulj/Libraries/monotouch-bindings/ATMHud/sample/MonoTouch.Dialog.dll" "/r:/Users/kovacsd/devel/mozdulj/Libraries/monotouch-bindings/facebook/binding/Facebook.dll" "/r:/Developer/MonoTouch/usr/lib/mono/2.1/System.Json.dll" "/r:/Developer/MonoTouch/usr/lib/mono/2.1/System.Web.Services.dll" /nologo /warn:4 /debug:full /optimize- /codepage:utf8 "/define:DEBUG"  /t:exe "/Users/kovacsd/devel/mozdulj/Libraries/monotouch-bindings/facebook/sample/Main.cs" 
Compilation succeeded - 1 warning(s)

/Users/kovacsd/devel/mozdulj/Libraries/monotouch-bindings/facebook/sample/Main.cs(217,33): warning CS0162: Unreachable code detected


Build complete -- 0 errors, 1 warning

Compiling to native code
/Developer/MonoTouch/usr/bin/mtouch -sdkroot "/Applications/Xcode.app/Contents/Developer" -v --nomanifest --nosign -sim "/Users/kovacsd/devel/mozdulj/Libraries/monotouch-bindings/facebook/sample/bin/iPhoneSimulator/Debug/sample.app" -r "/Developer/MonoTouch/usr/lib/mono/2.1/System.dll" -r "/Developer/MonoTouch/usr/lib/mono/2.1/System.Xml.dll" -r "/Developer/MonoTouch/usr/lib/mono/2.1/System.Core.dll" -r "/Developer/MonoTouch/usr/lib/mono/2.1/monotouch.dll" -r "/Users/kovacsd/devel/mozdulj/Libraries/monotouch-bindings/ATMHud/sample/MonoTouch.Dialog.dll" -r "/Users/kovacsd/devel/mozdulj/Libraries/monotouch-bindings/facebook/binding/Facebook.dll" -r "/Developer/MonoTouch/usr/lib/mono/2.1/System.Json.dll" -r "/Developer/MonoTouch/usr/lib/mono/2.1/System.Web.Services.dll" -debug -profiling -nolink -sdk "5.1" "/Users/kovacsd/devel/mozdulj/Libraries/monotouch-bindings/facebook/sample/bin/iPhoneSimulator/Debug/sample.exe"
MonoTouch version 5.2.13 using framework: /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator5.1.sdk
Copied /Users/kovacsd/devel/mozdulj/Libraries/monotouch-bindings/facebook/sample/bin/iPhoneSimulator/Debug/sample.exe to /Users/kovacsd/devel/mozdulj/Libraries/monotouch-bindings/facebook/sample/bin/iPhoneSimulator/Debug/sample.app/sample.exe
Copied /Developer/MonoTouch/usr/lib/mono/2.1/monotouch.dll to /Users/kovacsd/devel/mozdulj/Libraries/monotouch-bindings/facebook/sample/bin/iPhoneSimulator/Debug/sample.app/monotouch.dll
Copied /Developer/MonoTouch/usr/lib/mono/2.1/mscorlib.dll to /Users/kovacsd/devel/mozdulj/Libraries/monotouch-bindings/facebook/sample/bin/iPhoneSimulator/Debug/sample.app/mscorlib.dll
Copied /Developer/MonoTouch/usr/lib/mono/2.1/System.dll to /Users/kovacsd/devel/mozdulj/Libraries/monotouch-bindings/facebook/sample/bin/iPhoneSimulator/Debug/sample.app/System.dll
Copied /Developer/MonoTouch/usr/lib/mono/2.1/Mono.Security.dll to /Users/kovacsd/devel/mozdulj/Libraries/monotouch-bindings/facebook/sample/bin/iPhoneSimulator/Debug/sample.app/Mono.Security.dll
Copied /Developer/MonoTouch/usr/lib/mono/2.1/System.Core.dll to /Users/kovacsd/devel/mozdulj/Libraries/monotouch-bindings/facebook/sample/bin/iPhoneSimulator/Debug/sample.app/System.Core.dll
Copied /Developer/MonoTouch/usr/lib/mono/2.1/System.Xml.dll to /Users/kovacsd/devel/mozdulj/Libraries/monotouch-bindings/facebook/sample/bin/iPhoneSimulator/Debug/sample.app/System.Xml.dll
Copied /var/folders/1p/0r0j38dn71jdt871gtxg6srm0000gn/T/tmp5dfe35b3.tmp/Facebook.dll to /Users/kovacsd/devel/mozdulj/Libraries/monotouch-bindings/facebook/sample/bin/iPhoneSimulator/Debug/sample.app/Facebook.dll
Copied /Users/kovacsd/devel/mozdulj/Libraries/monotouch-bindings/ATMHud/sample/MonoTouch.Dialog.dll to /Users/kovacsd/devel/mozdulj/Libraries/monotouch-bindings/facebook/sample/bin/iPhoneSimulator/Debug/sample.app/MonoTouch.Dialog.dll
Copied /Developer/MonoTouch/usr/lib/mono/2.1/System.Web.Services.dll to /Users/kovacsd/devel/mozdulj/Libraries/monotouch-bindings/facebook/sample/bin/iPhoneSimulator/Debug/sample.app/System.Web.Services.dll
Copied /Developer/MonoTouch/usr/lib/mono/2.1/System.Json.dll to /Users/kovacsd/devel/mozdulj/Libraries/monotouch-bindings/facebook/sample/bin/iPhoneSimulator/Debug/sample.app/System.Json.dll
Copied /Developer/MonoTouch/usr/lib/mono/2.1/System.ServiceModel.Web.dll to /Users/kovacsd/devel/mozdulj/Libraries/monotouch-bindings/facebook/sample/bin/iPhoneSimulator/Debug/sample.app/System.ServiceModel.Web.dll
Copied /Developer/MonoTouch/usr/lib/mono/2.1/System.Runtime.Serialization.dll to /Users/kovacsd/devel/mozdulj/Libraries/monotouch-bindings/facebook/sample/bin/iPhoneSimulator/Debug/sample.app/System.Runtime.Serialization.dll
Copied /Developer/MonoTouch/usr/lib/mono/2.1/System.ServiceModel.dll to /Users/kovacsd/devel/mozdulj/Libraries/monotouch-bindings/facebook/sample/bin/iPhoneSimulator/Debug/sample.app/System.ServiceModel.dll
Generated /var/folders/1p/0r0j38dn71jdt871gtxg6srm0000gn/T/tmp5dfe35b3.tmp/main.m
/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/usr/bin/gcc -arch i386 -gdwarf-2 -fobjc-legacy-dispatch -fobjc-abi-version=2 -miphoneos-version-min=5.1 -arch i386  -std=c99 -I/Developer/MonoTouch/SDKs/MonoTouch.iphonesimulator.sdk/usr/include -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator5.1.sdk -c /var/folders/1p/0r0j38dn71jdt871gtxg6srm0000gn/T/tmp5dfe35b3.tmp/main.m -o /var/folders/1p/0r0j38dn71jdt871gtxg6srm0000gn/T/tmp5dfe35b3.tmp/main.x86.o -DDEBUG  
/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/usr/bin/gcc -arch i386 -gdwarf-2 -fobjc-legacy-dispatch -fobjc-abi-version=2 -miphoneos-version-min=5.1   -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator5.1.sdk /var/folders/1p/0r0j38dn71jdt871gtxg6srm0000gn/T/tmp5dfe35b3.tmp/main.x86.o -o /var/folders/1p/0r0j38dn71jdt871gtxg6srm0000gn/T/tmp5dfe35b3.tmp/sample -framework CFNetwork -framework Foundation -framework GameKit -framework MapKit -framework MediaPlayer -framework MessageUI -framework OpenGLES -framework StoreKit -framework UIKit -framework AddressBookUI -framework SystemConfiguration -framework AddressBook -framework AudioToolbox -framework AVFoundation -framework QuartzCore -framework CoreFoundation -framework CoreGraphics -framework CoreLocation -framework MobileCoreServices -framework Security -framework CoreData -framework ExternalAccessory -weak_framework AssetsLibrary -weak_framework Accounts -weak_framework CoreBluetooth -weak_framework CoreTelephony -weak_framework EventKit -weak_framework EventKitUI -weak_framework CoreMotion -weak_framework GLKit -weak_framework NewsstandKit -weak_framework Twitter -weak_framework iAd -weak_framework CoreImage -weak_framework CoreText -weak_framework ImageIO -weak_framework CoreMedia -weak_framework CoreVideo -weak_framework QuickLook -lz -u _mono_pmip -u _CreateZStream -u _CloseZStream -u _Flush -u _ReadZStream -u _WriteZStream -liconv -lmono-2.0 -lmonotouch -L/Developer/MonoTouch/SDKs/MonoTouch.iphonesimulator.sdk/usr/lib -u _catch_exception_raise -force_load /var/folders/1p/0r0j38dn71jdt871gtxg6srm0000gn/T/tmp5dfe35b3.tmp/libFacebookSDK.a
Process exited with code 1, command:
/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/usr/bin/gcc -arch i386 -gdwarf-2 -fobjc-legacy-dispatch -fobjc-abi-version=2 -miphoneos-version-min=5.1   -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator5.1.sdk /var/folders/1p/0r0j38dn71jdt871gtxg6srm0000gn/T/tmp5dfe35b3.tmp/main.x86.o -o /var/folders/1p/0r0j38dn71jdt871gtxg6srm0000gn/T/tmp5dfe35b3.tmp/sample -framework CFNetwork -framework Foundation -framework GameKit -framework MapKit -framework MediaPlayer -framework MessageUI -framework OpenGLES -framework StoreKit -framework UIKit -framework AddressBookUI -framework SystemConfiguration -framework AddressBook -framework AudioToolbox -framework AVFoundation -framework QuartzCore -framework CoreFoundation -framework CoreGraphics -framework CoreLocation -framework MobileCoreServices -framework Security -framework CoreData -framework ExternalAccessory -weak_framework AssetsLibrary -weak_framework Accounts -weak_framework CoreBluetooth -weak_framework CoreTelephony -weak_framework EventKit -weak_framework EventKitUI -weak_framework CoreMotion -weak_framework GLKit -weak_framework NewsstandKit -weak_framework Twitter -weak_framework iAd -weak_framework CoreImage -weak_framework CoreText -weak_framework ImageIO -weak_framework CoreMedia -weak_framework CoreVideo -weak_framework QuickLook -lz -u _mono_pmip -u _CreateZStream -u _CloseZStream -u _Flush -u _ReadZStream -u _WriteZStream -liconv -lmono-2.0 -lmonotouch -L/Developer/MonoTouch/SDKs/MonoTouch.iphonesimulator.sdk/usr/lib -u _catch_exception_raise -force_load /var/folders/1p/0r0j38dn71jdt871gtxg6srm0000gn/T/tmp5dfe35b3.tmp/libFacebookSDK.a
Undefined symbols for architecture i386:
  "_sqlite3_open_v2", referenced from:
      ___36-[FBCacheIndex initWithCacheFolder:]_block_invoke_0 in libFacebookSDK.a(FBCacheIndex.o)
  "_sqlite3_exec", referenced from:
      ___36-[FBCacheIndex initWithCacheFolder:]_block_invoke_0 in libFacebookSDK.a(FBCacheIndex.o)
  "_sqlite3_close", referenced from:
      ___23-[FBCacheIndex dealloc]_block_invoke_0 in libFacebookSDK.a(FBCacheIndex.o)
  "_sqlite3_finalize", referenced from:
      _releaseStatement in libFacebookSDK.a(FBCacheIndex.o)
  "_sqlite3_errmsg", referenced from:
      _releaseStatement in libFacebookSDK.a(FBCacheIndex.o)
      -[FBCacheIndex _updateEntryInDatabaseForKey:entry:] in libFacebookSDK.a(FBCacheIndex.o)
      _initializeStatement in libFacebookSDK.a(FBCacheIndex.o)
      -[FBCacheIndex _writeEntryInDatabase:] in libFacebookSDK.a(FBCacheIndex.o)
      -[FBCacheIndex _readEntryFromDatabase:] in libFacebookSDK.a(FBCacheIndex.o)
      -[FBCacheIndex _fetchCurrentDiskUsage] in libFacebookSDK.a(FBCacheIndex.o)
      -[FBCacheIndex _removeEntryFromDatabaseForKey:] in libFacebookSDK.a(FBCacheIndex.o)
      ...
  "_sqlite3_bind_text", referenced from:
      -[FBCacheIndex _updateEntryInDatabaseForKey:entry:] in libFacebookSDK.a(FBCacheIndex.o)
      -[FBCacheIndex _writeEntryInDatabase:] in libFacebookSDK.a(FBCacheIndex.o)
      -[FBCacheIndex _readEntryFromDatabase:] in libFacebookSDK.a(FBCacheIndex.o)
      -[FBCacheIndex _removeEntryFromDatabaseForKey:] in libFacebookSDK.a(FBCacheIndex.o)
  "_sqlite3_bind_double", referenced from:
      -[FBCacheIndex _updateEntryInDatabaseForKey:entry:] in libFacebookSDK.a(FBCacheIndex.o)
      -[FBCacheIndex _writeEntryInDatabase:] in libFacebookSDK.a(FBCacheIndex.o)
  "_sqlite3_bind_int", referenced from:
      -[FBCacheIndex _updateEntryInDatabaseForKey:entry:] in libFacebookSDK.a(FBCacheIndex.o)
      -[FBCacheIndex _writeEntryInDatabase:] in libFacebookSDK.a(FBCacheIndex.o)
      -[FBCacheIndex _trimDatabase] in libFacebookSDK.a(FBCacheIndex.o)
  "_sqlite3_step", referenced from:
      -[FBCacheIndex _updateEntryInDatabaseForKey:entry:] in libFacebookSDK.a(FBCacheIndex.o)
      -[FBCacheIndex _writeEntryInDatabase:] in libFacebookSDK.a(FBCacheIndex.o)
      -[FBCacheIndex _readEntryFromDatabase:] in libFacebookSDK.a(FBCacheIndex.o)
      -[FBCacheIndex _fetchCurrentDiskUsage] in libFacebookSDK.a(FBCacheIndex.o)
      -[FBCacheIndex _removeEntryFromDatabaseForKey:] in libFacebookSDK.a(FBCacheIndex.o)
      -[FBCacheIndex _dropTrimmingTable] in libFacebookSDK.a(FBCacheIndex.o)
      -[FBCacheIndex _trimDatabase] in libFacebookSDK.a(FBCacheIndex.o)
      ...
  "_sqlite3_prepare_v2", referenced from:
      _initializeStatement in libFacebookSDK.a(FBCacheIndex.o)
  "_sqlite3_reset", referenced from:
      _initializeStatement in libFacebookSDK.a(FBCacheIndex.o)
  "_sqlite3_column_text", referenced from:
      -[FBCacheIndex _readEntryFromDatabase:] in libFacebookSDK.a(FBCacheIndex.o)
      -[FBCacheIndex _trimDatabase] in libFacebookSDK.a(FBCacheIndex.o)
  "_sqlite3_column_double", referenced from:
      -[FBCacheIndex _readEntryFromDatabase:] in libFacebookSDK.a(FBCacheIndex.o)
  "_sqlite3_column_int", referenced from:
      -[FBCacheIndex _readEntryFromDatabase:] in libFacebookSDK.a(FBCacheIndex.o)
      -[FBCacheIndex _fetchCurrentDiskUsage] in libFacebookSDK.a(FBCacheIndex.o)
      -[FBCacheIndex _trimDatabase] in libFacebookSDK.a(FBCacheIndex.o)
ld: symbol(s) not found for architecture i386
collect2: ld returned 1 exit status

mtouch exited with code 1

---------------------- Done ----------------------

Build: 1 error, 1 warning

我尝试添加 Mono.Date.Sqlite 但结果是一样的。

在我恢复到旧版本后它可以工作..

4

1 回答 1

1

这可能是因为新版本的Facebook原生库需要sqlite,而之前的版本不需要。

添加Mono.Date.Sqlite只会帮助托管代码,即如果使用来自该程序集的代码,它将在运行时进行动态链接。修复本机代码要求,sqlite需要在(本机)编译/链接时可用。

最好的方法是更新 facebook 绑定以确保它的[LinkWith]属性包括与sqlite链接的说明(更多详细信息在本文中)。

您还应该能够通过添加以下内容将其添加到您自己的项目中(但不要忘记对Debug|Release两种iPhone|iPhoneSimulator配置都这样做):

-gcc_flags "-lsqlite"

到项目的构建选项中的“附加 mtouch 参数”(本文中的更多详细信息)。

于 2012-08-19T23:49:38.237 回答