问题描述
我正在尝试从Xamarin应用程序调用Card.IO。尝试编译我的应用程序时收到 i386体系结构的未定义符号。,它在消息中引用了 std :: terminate()。该应用程序专用于iPhone,我不知道 i386来自何处-我可以在项目选项中找到的所有设置都设置为ARMv7,绑定中的LinkWith属性也设置为。
$ b
Card.IO的指南指出,我需要在Xcode的其他链接器标志中添加 -lstdc ++
,但我不知道该在哪里将其放在Xamarin Studio的选项中
问题是:我如何使此绑定起作用?绑定中是否有错误?
我使用了生成下面的代码
使用系统;
使用System.Drawing;
使用MonoTouch.ObjCRuntime;
使用MonoTouch.Foundation;
使用MonoTouch.UIKit;
名称空间CardIO
{
[BaseType(typeof(NSObject))]
公共部分接口CardIOCreditCardInfo {
[导出( cardNumber )]
字符串CardNumber {get;组; }
[导出( redactedCardNumber)]
字符串RedactedCardNumber {get; }
[导出( expiryMonth)]
uint ExpiryMonth {get;组; }
[导出( expiryYear)]
uint ExpiryYear {get;组; }
[导出( cvv)]
字符串Cvv {get;组; }
[导出( zip)]
字符串Zip {get;组; }
[导出(扫描)]
bool扫描{get;组; }
[导出( cardType)]
CardIOCreditCardType CardType {get; }
[静态,导出( displayStringForCardType:usingLanguageOrLocale:)]
字符串DisplayStringForCardType(CardIOCreditCardType cardType,字符串languageOrLocale);
[静态,导出( logoForCardType:)]
NSObject LogoForCardType(CardIOCreditCardType cardType);
}
[模型]
[BaseType(typeof(NSObject))]
公共部分接口CardIOPaymentViewControllerDelegate {
[导出( userDidCancelPaymentViewController:)]
void UserDidCancelPaymentViewController(CardIOPaymentViewControllerpaymentViewController);
[导出( userDidProvideCreditCardInfo:inPaymentViewController:)]
void UserDidProvideCreditCardInfo(CardIOCreditCardInfo info,CardIOPaymentViewController paymentViewController);
}
[BaseType(typeof(UINavigationController))]
公共部分接口CardIOPaymentViewController {
[导出( initWithPaymentDelegate:)]
IntPtr构造函数(CardIOPaymentViewControllerDelegate aDelegate);
[导出( initWithPaymentDelegate:scanningEnabled:)]
IntPtr构造函数(CardIOPaymentViewControllerDelegate aDelegate,bool scanEnabled);
[导出( appToken)]
字符串AppToken {get;组; }
[导出( languageOrLocale)]
字符串LanguageOrLocale {get;组; }
[导出( keepStatusBarStyle)]
bool KeepStatusBarStyle {get;组; }
[导出( navigationBarStyle)]
UIBarStyle NavigationBarStyle {get;组; }
[导出( navigationBarTintColor)]
UIColor NavigationBarTintColor {get;组; }
[导出( disableBlurWhenBackgrounding)]
bool DisableBlurWhenBackgrounding {get;组; }
[导出( collectExpiry)]
bool CollectExpiry {get;组; }
[导出( collectCVV)]
bool CollectCvv {get;组; }
[导出( collectZip)]
bool CollectZip {get;组; }
[导出( showsFirstUseAlert)]
bool ShowsFirstUseAlert {get;组; }
[导出( useCardIOLogo)]
bool UseCardIolOgo {get;组; }
[导出( disableManualEntryButtons)]
bool DisableManualEntryButtons {get;组; }
[导出( paymentDelegate)]
CardIOPaymentViewControllerDelegate PaymentDelegate {get;组; }
[导出( canReadCardWithCamera)]
bool CanReadCardWithCamera {get; }
[导出( libraryVersion)]
字符串LibraryVersion {get; }
}
}
我还添加了Card.IO列出的框架.linkswith文件的站点:
[assembly:LinkWith( libCardIO.a,LinkTarget .ArmV7 | LinkTarget.ArmV7s | LinkTarget.Simulator,ForceLoad = true
,Frameworks = AVFoundation AudioToolbox CoreMedia CoreVideo MobileCoreServices OpenGLES QuartzCore Security UIKit)]
然后我在我的应用程序中向新创建的绑定项目中添加了项目引用,但它没有编译。我在Xamarin的输出控制台中收到此错误:
进程退出,代码为1,命令:
/ Applications / Xcode。 app / Contents / Developer / Platforms / iPhoneSimulator.platform / Developer / usr / bin / gcc -Wl,-no_pie -arch i386 -gdwarf-2 -fobjc-legacy-dispatch -fobjc-abi-version = 2 -miphoneos-version- min = 6.1 -arch i386 -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator6.1.sdk / Users / Sten / Dropbox / Code / Projects / Tabit / TabitOne_iPhone / TabitOne /obj/iPhoneSimulator/Debug/mtouch-cache/main.i386.cache.OHBLJlHbpZ74bpnhszg9JrCN8A8=.o -o /o/var/folders/bb/2tbfzn4n2dq6rsmtpv_jlmbr0000gq/T/tmp59582304.tmp/TabitOne -frameworkFrameworks CoreBluetooth-框架CoreTelephony-框架EventKit-框架EventKitUI-框架Foundation-框架CoreMotion-框架GameKit-框架GLKit-框架iAd-框架MapKit-框架MediaPlayer-框架MessageUI -框架NewsstandKit-框架OpenGLES-框架社会-框架StoreKit-框架Twitter-框架UIKit-框架PassKit-框架AddressBookUI-框架AudioToolbox-框架SystemConfiguration-框架AddressBook-框架AVFoundation-框架QuartzCore-框架CoreData-框架CoreGraphics-框架CoreImage-框架CoreLocation-框架CoreText-框架ImageIO-框架MobileCoreServices-框架安全-框架CoreMedia-框架CoreMIDI-框架CoreVideo-框架ExternalAccessory-框架AdSupport-框架QuickLook -lz -liconv -u _mono_pmip -u _monotouch_create_managed_ref -u _monotouch_t_t_t_t_t_t_t_t_t_t -u _CloseZStream -u _CreateZStream -u _Flush -u _ReadZStream -u _WriteZStream -lmono-2.0 -lmonotouch-debug -L / Developer / MonoTouch / SDKs / MonoTouch.iphonesimulator.sdk / usr / lib -u _catch_exception_raise -force_load / var / fold rs / bb / 2tbfzn4n2dq6rsmtpv_jlmbr0000gq / T / tmp59582304.tmp / libCardIO.a
**体系结构i386的未定义符号:**
** std :: terminate()**,引用自: b $ b-libCardIO.a(CardIOGPURenderer.o)中的[CardIOGPURenderer dealloc]
___gxx_personality_v0,引用自:
libCardIO.a(CardIOAnalytics.o)中的Dwarf Exception Unwind Info(__eh_frame)
矮人异常展开信息(__eh_frame)在$ libCardIO.a(CardIOGPURenderer.o)中$ b矮人异常展开信息(__eh_frame)在libCardIO.a(CardIOAnimation.o)中
矮人异常展开信息(__eh_frame) libCardIO.a(CardIOAnalytics.o)
libCardIO.a(CardIOGPURenderer.o)中的Dwarf异常展开信息(__eh_frame)
libCardIO.a(CardIOAnimation.o)中的Dwarf异常展开信息(__eh_frame)
libCardIO.a(CardIOAnalytics.o)中的Dwarf异常展开信息(__eh_frame)
libCardIO.a(CardIOGPURenderer.o)中的Dwarf异常展开信息(__eh_frame)
Dwarf libCardIO.a(CardIOAnimation.o)中的异常展开信息(__eh_frame)
ld:找不到体系结构i386
collect2的符号:ld返回1退出状态
错误MT5202:本机链接失败。请查看构建日志。
好,多亏了另一个我通过编辑我的应用程序的项目选项来使其工作,在页面 iOS Build中,在字段 Additional mtouch arguments中输入值:
-cxx -gcc_flags -lstdc ++
I'm attempting to call Card.IO from my Xamarin app. I get "Undefined symbols for architecture i386:" when I try to compile my app and it cites "std::terminate()" in the message. The app is intended for iPhone, I don't know where did the "i386" come from - all settings in project options that I can find are set to ARMv7, so is the LinkWith attribute in the binding.
Card.IO's guide states I need to add -lstdc++
to "other linker flags" in Xcode but I don't know where should I put this in Xamarin Studio's options
Question is: how do I make this binding work? Is there an error in the binding? Is there some project setting or somehow adding more framework references in my app?
I used Objective Sharpie to generate the code below
using System;
using System.Drawing;
using MonoTouch.ObjCRuntime;
using MonoTouch.Foundation;
using MonoTouch.UIKit;
namespace CardIO
{
[BaseType (typeof (NSObject))]
public partial interface CardIOCreditCardInfo {
[Export ("cardNumber")]
string CardNumber { get; set; }
[Export ("redactedCardNumber")]
string RedactedCardNumber { get; }
[Export ("expiryMonth")]
uint ExpiryMonth { get; set; }
[Export ("expiryYear")]
uint ExpiryYear { get; set; }
[Export ("cvv")]
string Cvv { get; set; }
[Export ("zip")]
string Zip { get; set; }
[Export ("scanned")]
bool Scanned { get; set; }
[Export ("cardType")]
CardIOCreditCardType CardType { get; }
[Static, Export ("displayStringForCardType:usingLanguageOrLocale:")]
string DisplayStringForCardType (CardIOCreditCardType cardType, string languageOrLocale);
[Static, Export ("logoForCardType:")]
NSObject LogoForCardType (CardIOCreditCardType cardType);
}
[Model]
[BaseType (typeof (NSObject))]
public partial interface CardIOPaymentViewControllerDelegate {
[Export ("userDidCancelPaymentViewController:")]
void UserDidCancelPaymentViewController (CardIOPaymentViewController paymentViewController);
[Export ("userDidProvideCreditCardInfo:inPaymentViewController:")]
void UserDidProvideCreditCardInfo (CardIOCreditCardInfo info, CardIOPaymentViewController paymentViewController);
}
[BaseType (typeof (UINavigationController))]
public partial interface CardIOPaymentViewController {
[Export ("initWithPaymentDelegate:")]
IntPtr Constructor (CardIOPaymentViewControllerDelegate aDelegate);
[Export ("initWithPaymentDelegate:scanningEnabled:")]
IntPtr Constructor (CardIOPaymentViewControllerDelegate aDelegate, bool scanningEnabled);
[Export ("appToken")]
string AppToken { get; set; }
[Export ("languageOrLocale")]
string LanguageOrLocale { get; set; }
[Export ("keepStatusBarStyle")]
bool KeepStatusBarStyle { get; set; }
[Export ("navigationBarStyle")]
UIBarStyle NavigationBarStyle { get; set; }
[Export ("navigationBarTintColor")]
UIColor NavigationBarTintColor { get; set; }
[Export ("disableBlurWhenBackgrounding")]
bool DisableBlurWhenBackgrounding { get; set; }
[Export ("collectExpiry")]
bool CollectExpiry { get; set; }
[Export ("collectCVV")]
bool CollectCvv { get; set; }
[Export ("collectZip")]
bool CollectZip { get; set; }
[Export ("showsFirstUseAlert")]
bool ShowsFirstUseAlert { get; set; }
[Export ("useCardIOLogo")]
bool UseCardIolOgo { get; set; }
[Export ("disableManualEntryButtons")]
bool DisableManualEntryButtons { get; set; }
[Export ("paymentDelegate")]
CardIOPaymentViewControllerDelegate PaymentDelegate { get; set; }
[Export ("canReadCardWithCamera")]
bool CanReadCardWithCamera { get; }
[Export ("libraryVersion")]
string LibraryVersion { get; }
}
}
I also added the frameworks listed in Card.IO's site to the .linkswith file:
[assembly: LinkWith ("libCardIO.a", LinkTarget.ArmV7 | LinkTarget.ArmV7s | LinkTarget.Simulator, ForceLoad = true
, Frameworks="AVFoundation AudioToolbox CoreMedia CoreVideo MobileCoreServices OpenGLES QuartzCore Security UIKit")]
Then I added a project reference in my app to the newly created binding project but it doesn't compile. I get this error in Xamarin's output console:
Process exited with code 1, command:
/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/usr/bin/gcc -Wl,-no_pie -arch i386 -gdwarf-2 -fobjc-legacy-dispatch -fobjc-abi-version=2 -miphoneos-version-min=6.1 -arch i386 -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator6.1.sdk /Users/Sten/Dropbox/Code/Projects/Tabit/TabitOne_iPhone/TabitOne/obj/iPhoneSimulator/Debug/mtouch-cache/main.i386.cache.OHBLJlHbpZ74bpnhszg9JrCN8A8=.o -o /var/folders/bb/2tbfzn4n2dq6rsmtpv_jlmbr0000gq/T/tmp59582304.tmp/TabitOne -framework CFNetwork -framework AssetsLibrary -framework Accounts -framework CoreBluetooth -framework CoreTelephony -framework EventKit -framework EventKitUI -framework Foundation -framework CoreMotion -framework GameKit -framework GLKit -framework iAd -framework MapKit -framework MediaPlayer -framework MessageUI -framework NewsstandKit -framework OpenGLES -framework Social -framework StoreKit -framework Twitter -framework UIKit -framework PassKit -framework AddressBookUI -framework AudioToolbox -framework SystemConfiguration -framework AddressBook -framework AVFoundation -framework QuartzCore -framework CoreData -framework CoreGraphics -framework CoreImage -framework CoreLocation -framework CoreText -framework ImageIO -framework MobileCoreServices -framework Security -framework CoreMedia -framework CoreMIDI -framework CoreVideo -framework ExternalAccessory -framework AdSupport -framework QuickLook -lz -liconv -u _mono_pmip -u _monotouch_create_managed_ref -u _monotouch_release_managed_ref -u _monotouch_IntPtr_objc_msgSend_IntPtr -u _monotouch_IntPtr_objc_msgSendSuper_IntPtr -u _CloseZStream -u _CreateZStream -u _Flush -u _ReadZStream -u _WriteZStream -lmono-2.0 -lmonotouch-debug -L/Developer/MonoTouch/SDKs/MonoTouch.iphonesimulator.sdk/usr/lib -u _catch_exception_raise -force_load /var/folders/bb/2tbfzn4n2dq6rsmtpv_jlmbr0000gq/T/tmp59582304.tmp/libCardIO.a
**Undefined symbols for architecture i386:**
"**std::terminate()**", referenced from:
-[CardIOGPURenderer dealloc] in libCardIO.a(CardIOGPURenderer.o)
"___gxx_personality_v0", referenced from:
Dwarf Exception Unwind Info (__eh_frame) in libCardIO.a(CardIOAnalytics.o)
Dwarf Exception Unwind Info (__eh_frame) in libCardIO.a(CardIOGPURenderer.o)
Dwarf Exception Unwind Info (__eh_frame) in libCardIO.a(CardIOAnimation.o)
Dwarf Exception Unwind Info (__eh_frame) in libCardIO.a(CardIOAnalytics.o)
Dwarf Exception Unwind Info (__eh_frame) in libCardIO.a(CardIOGPURenderer.o)
Dwarf Exception Unwind Info (__eh_frame) in libCardIO.a(CardIOAnimation.o)
Dwarf Exception Unwind Info (__eh_frame) in libCardIO.a(CardIOAnalytics.o)
Dwarf Exception Unwind Info (__eh_frame) in libCardIO.a(CardIOGPURenderer.o)
Dwarf Exception Unwind Info (__eh_frame) in libCardIO.a(CardIOAnimation.o)
ld: symbol(s) not found for architecture i386
collect2: ld returned 1 exit status
error MT5202: Native linking failed. Please review the build log.
Ok, thanks to the answer in another SO post I got this to work by editing my app's project options, page "iOS Build", field "Additional mtouch arguments" where I put the value:
-cxx -gcc_flags "-lstdc++"
这篇关于Card.io绑定项目无法进行应用编译的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!