这个框架取决于另外两个.
我创建了绑定项目,成功生成了ApiDefinitions.cs文件和StructsAndEnums.cs.到现在为止还挺好.
现在,当我尝试在调试模式下构建它时,我得到大约30个关于临时文件中语法问题的错误.
这些错误仅发生在Trampolines.g.cs和SupportDelegates.g.cs文件中.
这两个中最糟糕的是SupportDelegates.g.cs文件,如下所示:
// // Auto-generated from generator.cs, do not edit // // We keep references to objects, so warning 414 is expected #pragma warning disable 414 using System; using System.Drawing; using System.Diagnostics; using System.ComponentModel; using System.Threading.Tasks; using System.Runtime.InteropServices; using System.Runtime.CompilerServices; using UIKit; using GLKit; using Metal; using MapKit; using Photos; using ModelIO; using SceneKit; using Contacts; using Security; using Messages; using AudioUnit; using CoreVideo; using CoreMedia; using QuickLook; using CoreImage; using SpriteKit; using Foundation; using CoreMotion; using ObjCRuntime; using AddressBook; using MediaPlayer; using GameplayKit; using CoreGraphics; using CoreLocation; using AVFoundation; using NewsstandKit; using FileProvider; using CoreAnimation; using CoreFoundation; namespace System.Action`1[[Foundation.NSString, Xamarin.iOS, Version=0.0.0 { public delegate void 0, Culture=neutral, PublicKeyToken=84e04ff9cfb79065]] (NSString obj); }
Trampolines.g.cs文件几乎完全生成,但在生成的C#代码中间出现了同样的问题:
static internal class SDActionArity2V1 { static internal readonly DActionArity2V1 Handler = Invoke; [MonoPInvokeCallback (typeof (DActionArity2V1))] static unsafe void Invoke (IntPtr block, IntPtr arg1, IntPtr arg2) { var descriptor = (BlockLiteral *) block; var del = (global::System.Action<NSString, global::System.Action<NSString>>) (descriptor->Target); if (del != null) del ( Runtime.GetNSObject<NSString> (arg1), (System.Action`1[Foundation.NSString]) Marshal.GetDelegateForFunctionPointer (arg2, typeof (System.Action`1[Foundation.NSString]))); } }
一些其他绑定项目正在生成相同类型的文件,并且eveything似乎工作正常,所以我实际上正在努力找到这个的根本原因.
有任何想法吗 ?
编辑:
这里给出更多信息是生成的接口定义
https://gist.github.com/Miiite/367e17335431e932acdc92c65b504bd4
EDIT2:这是sharpie生成的日志输出
https://gist.github.com/Miiite/e272622df2e853d53f1add4c8eb4eabf
void PresentCheckoutForSubmittingTransactionCompletionHandler(Action< OPPTransaction,NSError> completionHandler,[NullAllowed] Action< NSString,Action< NSString>> paymentBrandSelectedHandler,[NullAllowed] Action cancelHandler);
我认为Action内部的Action导致问题,生成器可能不支持这个,所以你可能需要找到一种不同的绑定方式.