1

I've resorted to using apns-sharp and while it works perfectly as a console app and as a basichttpbinding WCF service on my machine(tested with wcftestclient), when I host the WCF service in IIS it doesnt give me any errors(SSL enabled).

Since I use monotouch for development I built the required classes using slsvcutil. I tested a few asynchronous calls and they work fine and return the right values. The issue is my application crashes when I make a call to send the push notification.

I call it like any other method call as below:

 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);
        }
        } );


    }

and here is the error and stack trace:

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

Your help is much appreciated.

John D
  • 639
  • 1
  • 10
  • 20
  • It looks to me like the server is throwing a fault, but `FaultException`'s constructor got removed in the MonoTouch app during the linking process. What happens in the simulator? The same? I would wrap the server side message in a `try-catch` and see if you can return the real error to the client. – jonathanpeppers Jun 21 '12 at 12:17
  • @jonathan. I ended up writing a console test client and called push method from teh web service above. It turns out it was looking for the p12 file in the wrong location. I corrected the path, however it now shows that its sent when it infact hasn't. i reverted back to moon-apns. Tested and works. I wonder why ans-sharp won't send though. – John D Jul 03 '12 at 13:38

0 Answers0