Olex
Olex

Reputation: 1656

MessageUI in iOS 6.0 issue

Beginner's question in Xcode and obj-c.

In my project I have a button with IBAction to send sms-messages without living my app (MessageUI linked to the project). At iOS 5 code worked well, but when I opened same project in latest Xcode to recompile it for iOS 6 I received warning: http://uaimage.com/image/10e31752 Is it something changed for using MessageUI in iOS 6?

Thanks for your attention!

Upvotes: 3

Views: 1130

Answers (3)

Oscar Salguero
Oscar Salguero

Reputation: 10375

Well... something really weird just happened.

My project structure is as follows:

YourProject (Root of the project with Xcode Project Icon)
    /YourProject (Folder)
        /Group X (Nested Folder)
            /SomeViewController.h
        /Group Y (Nested Folder)
            /Group Y1 (Nested Folder)
                /OtherViewController.h
            /Group Y2 (Another Nested Folder)
                /YetAnotherViewController.h

The class SomeViewController, using MFMessageComposeViewControllerDelegate and MFMailComposeViewControllerDelegate worked fine:

...
@interface SomeViewController : UIViewController <MFMessageComposeViewControllerDelegate, MFMailComposeViewControllerDelegate> {}
...

The classes OtherViewController and YetAnotherViewController, using the same MFMessageComposeViewControllerDelegate and MFMailComposeViewControllerDelegate won't compile!

Errors were:

  • Cannot find protocol declaration for 'MFMessageComposeViewControllerDelegate'

and/or

  • Cannot find protocol declaration for 'MFMailComposeViewControllerDelegate'.

So I checked and re-checked imports, declared all the methods and my ViewControllers were the same, only differences were their names the data object.

At the end the solution was really silly! I solved this annoyance by moving the nested folders one level up. Everything compiles nicely!

Apparently the import of the libraries (when you add them to your project) does not reach files in Sub-Groups! I guess it is a bug with XCode and iOS 6, but I was getting the same errors.

Since the groups are virtual folders (they are not in the file system) just in the Project structure this is really weird.

I hope to save time and someone from a headache!

Upvotes: 1

LombaX
LombaX

Reputation: 17364

Looking at this image:

http://uaimage.com/image/e71f051f

You have to use MFMessageComposeViewControllerDelegate and not MFMailComposeViewControllerDelegate

Upvotes: 3

user1025285
user1025285

Reputation:

Add MFMessageComposeViewControllerDelegate to your Header(.h) File.

Example: UIViewController< MFMessageComposeViewControllerDelegate>

Upvotes: 0

Related Questions