[69254 Closed] Internal Error when implementing IMFMessageComposeViewControllerDelegate

A straightforward test case for this one:

  • New Empty iOS Project

  • “Add Reference” : MessageUI

  • Add a new class to Program.pas implementing IMFMessageComposeViewControllerDelegate:

    Foo = public class(NSObject, IMFMessageComposeViewControllerDelegate)
    method messageComposeViewController(controller: MFMessageComposeViewController) didFinishWithResult(&result: MessageComposeResult);
    end;

Provide an empty implementation for the required method.

Compilation at this point fails with:

"Internal Error: Operation is not valid due to the current state of the object"

Help ?!!?

Supplementary information:

Before I whittled my problems down to this simple test case I previously found that I was unable to form a case statement involving MessageComposeResult enum members. Attempting to do so resulted in compilation errors:

'Type mismatch, cannot find operator to evaluate "void" = "Void"'

It didn’t make any difference which of the two forms I used:

  MessageComposeResult.MessageComposeResultCancelled: ;
  // or
  MessageComposeResult.Cancelled: ;

This issue may be related, but also occurs in isolation. i.e. remove the class attempting to implement the interface as described above, then simply add the following to iOS project Program.Main() method:

var r: MessageComposeResult;
case r of
   MessageComposeResult.Cancelled: ;
end;

Using Oxygene, 1599 beta.

Out of curiosity I just updated to the latest beta (1603) to see if that helped. I didn’t think it would as the change log didn’t suggest anything changed that might have had a bearing on this. And it hasn’t. Both problems remains.

One further piece of information…

Whatever the problem is, I don’t think it is the delegate interface itself - if I remove that from the class declaration and simply leave the method implemented without that corresponding interface, I still get the same problem.

And some more information… I think the issue lies with the MessageComposeResult type somehow since simply adding this to a class (with a corresponding empty method body) is enough to trigger the problem:

method foo(bar: MessageComposeResult);

The clincher is that in fact, just adding a member variable of this type is enough to trigger it !

The IDE “type insight” might provide some clue as to what is going on:

Surely an enum should ‘extend’ integer or some ordinal type (other enums appear to) ? This might also explain why the case statement threw up such strange “void” related errors when involving this type.

Thanks, logged as bugs://69254: Internal Error when implementing IMFMessageComposeViewControllerDelegate

It’s looking like an importer bug. Investigating now.

Update: Yes, it’s a bug in the header importer, fixed internally & for next build. LEt me know if this is blocking you, if so we can give you a new build.

bugs://69254 got closed as fixed for release Andromeda Class

Yes, it is blocking me… :frowning:

I had two choices… write a simple test using this controller view and then build the UI of my app around it. But since it was such a straightforward controller I decided to build my UI first and then just plug this in at the end, so this is the only thing now preventing me from completing my app.

( Not having a go, just having a bit of a laugh at myself :slight_smile: )

Thanks for the rapid response (as usual!). :slight_smile:

here’s a new messageui (ios8); I think you can safely replce this even for ios7 but I haven’t tried (I don’t have the old xcode handy)
MessageUI.zip (9.7 KB)

Great stuff, thanks for that. I’ll let you know how I get on when I get a chance to try this tonight.

Unfortunately I didn’t get very far at all… I perhaps should have mentioned that I am currently having to develop against the simulator and the fx file you provided appears to be only for actual device hardware.

Also fyi 7.1 is the SDK I am using (if that is at all helpful).

Use these: https://dl.dropboxusercontent.com/u/29927944/SDKs.zip

the next build should have them included, but this should get you going with 7.1.

Thanks again! Pesky time difference means that I again won’t be able to try these until this evening.

Have tried the new fx files and all sorted. Thanks. :slight_smile:

cool. Thanks for letting me know.