1 Reply Latest reply: Oct 12, 2012 9:34 AM by rebel399
Friendlyman Level 1 Level 1

im trying to build an application that can sending sms and im using ios 6 and xcode 4.5


the code is not working fine in ios and give me this error


2012-10-02 13:13:30.688 AutoSms[1436:907] Warning: Attempt to present <MFMessageComposeViewController: 0x1c598fa0> on <SecondViewController: 0x1c5755b0> whose view is not in the window hierarchy!



anybody can help me?!!

iPhone 5, iOS 6
  • rebel399 Level 1 Level 1

    Hi Friendlyman, I ran into the same problem.   MFMessage.. code that worked under Xcode 4.1 & 4.2 using iOS4.3 & iOS5.1 starting issuing the warning message using iPhone 4 with xcode 4.5/iOS6.  The result was the MFMessageComposeViewController, which presents the SMS screen doesn't load.  The good news is that it really is a warning message.


    Basically, here's what's happening - your cancelling the SMS screen <MFMessageComposeViewController> before it gets a chance to load.   In early versions of iOS, you could present your screen <SecondViewController>, call the MFMessageComposeViewController, and queue an exit/dismiss screen {modally or remove subview} that would occur after you click the Send button on the SMS screen.  In iOS6.0 you cannot do that anymore.


    Your MFMessageViewController delegate method can still dismiss the SMS screen.   The dismiss or removal of the subview for your <SecondViewController> must occur separately.   The best place to remove the <SecondViewController> appears to be in the viewDidAppear method, which will be triggered after you dismiss the SMS <MFMessageComposeViewController> screen.



    Pre iOS6: load your screen, call MFMessage, dismiss your screen.

    iOS6: load your screen, call MFMessage, capture your screen reload event in viewDidAppear method, dismss your screen in viewDidAppear method.


    Hope the above helps.