我已经求助于使用apns-sharp,虽然它可以完美地作为控制台应用程序和我机器上的基本 httpbinding WCF 服务(使用 wcftestclient 测试),但当我在 IIS 中托管 WCF 服务时,它不会给我任何错误(启用 SSL )。
由于我使用 monotouch 进行开发,因此我使用 slsvcutil 构建了所需的类。我测试了一些异步调用,它们工作正常并返回正确的值。问题是当我打电话发送推送通知时我的应用程序崩溃了。
我像下面的任何其他方法调用一样调用它:
client.PushCompleted += HandlePushCompleted;
client.PushAsync();
void HandlePushCompleted (object sender, PushCompletedEventArgs e)
{
InvokeOnMainThread( delegate{
try
{
string value = e.Result.ToString();
}
catch(Exception ex)
{
Console.WriteLine("ERROR IS " + ex.InnerException);
Console.WriteLine("STACKTRACE IS " + ex.StackTrace);
}
} );
}
这是错误和堆栈跟踪:
ERROR IS System.MissingMethodException: No constructor found for
System.ServiceModel.FaultException`1[[System.ServiceModel.Except ionDetail
, System.ServiceModel, Version=2.0.5.0, Culture=neutral,
PublicKeyToken=31bf3856ad364e35]]::.ctor(System.ServiceModel.ExceptionDetail,
System.ServiceModel.FaultReason, System.ServiceModel.FaultCode, (unknown))
at System.Activator.CreateInstance (System.Type type, BindingFlags bindingAttr,
System.Reflection.Binder binder, System.Object[] args,
System.Globalization.CultureInfo culture, System.Object[]
activationAttributes) [0x00174]
in /Developer/ MonoTouch/Source/mono/mcs/class/corlib/System/Activator.cs:299
at System.Activator.CreateInstance (System.Type type,
System.Object[] args, System.Object[] activationAttributes) [0x00000]
in /Developer/MonoTouch/Source/mono/mcs/class/corlib/ System/Activator.cs:234
at System.Activator.CreateInstance (System.Type type, System.Object[] args)
[0x00000] in
/Developer/MonoTouch/Source/ mono/mcs/class/corlib/System/Activator.cs:229
at System.ServiceModel.MonoInternal.ClientRuntimeChannel.Request
(System.ServiceModel.Description.OperationDescription od,
System.Object[] parameters) [0x001a6] in
/Developer/MonoTouch/Source/mono/mcs/class/System.ServiceModel
/System.ServiceModel/ClientRuntimeChannel.cs:557 at
System.ServiceModel.MonoInternal.ClientRuntimeChannel.DoProcess
(System.Reflection.MethodBase method, System.String operationName,
System.Object[] parameters) [0x00038] in
/Developer/MonoTouch/Source/mono/mcs/class/System.ServiceModel
/System.ServiceModel/ClientRuntimeChannel.cs:502 at
System.ServiceModel.MonoInternal.ClientRuntimeChannel.Process
(System.Reflection.MethodBase method, System.String operationName,
System.Object[] parameters) [0x0001c] in
/Developer/MonoTouch/Source/mono/mcs/class/System.ServiceModel
/System.ServiceModel/ClientRuntimeChannel.cs:479
STACKTRACE IS at
System.ComponentModel.AsyncCompletedEventArgs.RaiseExceptionIfNecessary ()
[0x0002d] in /Developer/MonoTouch/Source/mono/mcs/class/System
/System.ComponentModel/AsyncCompletedEventArgs.cs:54 at
PushCompletedEventArgs.get_Result () [0x00000] in
/Users/*/Desktop/App/Apps/proxy/Service.cs:273 at
ElectricityIOSApp.FirstViewController+c_AnonStorey1.<>m_2 ()
[0x00000] in /Users/*/Desktop/App/Apps/AppController.cs:519
非常感谢您的帮助。