Resolved iOS 7.0.2 Breaks edgesForExtendedLayout Compile

Discussion in 'iOS Programming' started by xStep, Oct 15, 2013.

  1. xStep, Oct 15, 2013
    Last edited: Oct 15, 2013

    xStep macrumors 68000

    Joined:
    Jan 28, 2003
    Location:
    Less lost in L.A.
    #1
    Coworker had issue with an iPad running 7.0.2 and using edgesForExtendedLayout. Compiler error is "Property 'edgesForExtendedLayout' not found on object of type 'MyViewController *'". No, the subclass isn't really named MyViewController.

    Oh, it also says; Use of undeclared identifier 'UIRectEdgeNone'.

    This error only appeared when trying to compile with the iPad connected and as the target for debugging.

    The code in question is;
    Code:
    self.edgesForExtendedLayout = UIRectEdgeNone;
    I had iOS 7.0 on my iPhone and entered the same line for one of my view controllers in a different project. The code compiled fine with the device connected and being the target device.

    I upgraded to 7.0.2 and now get the same error as my coworker.

    The deployment targets for both our projects is iOS 5. Tried 6 and 6.1 with same result.

    Anyone seen this problem and have a fix?

    So far, if we make the deployment target iOS 7, the problem is resolved. These apps have the need to run on devices running less than iOS 7.
     
  2. dejo Moderator

    dejo

    Staff Member

    Joined:
    Sep 2, 2004
    Location:
    The Centennial State
    #2
    edgesForExtendedLayout is only available in iOS 7.0 or later. You can check for it at run-time using something like:
    Code:
    if ([self respondsToSelector:@selector(edgesForExtendedLayout)])
    {
        [self setEdgesForExtendedLayout:UIRectEdgeNone];
    }
     
  3. xStep thread starter macrumors 68000

    Joined:
    Jan 28, 2003
    Location:
    Less lost in L.A.
    #3
    Agreed that is the right way to check it, but that isn't my problem. The issue is a compiler error.

    Also to clarify, the SDK being used is the iOS 7 one.
     
  4. PhoneyDeveloper macrumors 68040

    PhoneyDeveloper

    Joined:
    Sep 2, 2008
    #4
    I don't see how compiling is connected to which device is connected. I guess you are using the device SDK and not the Sim SDK, which are different in some ways.

    You should be able to find where in the header files this property is declared and then you can find out why it thinks it's not declared.
     
  5. xStep, Oct 15, 2013
    Last edited: Oct 15, 2013

    xStep thread starter macrumors 68000

    Joined:
    Jan 28, 2003
    Location:
    Less lost in L.A.
    #5
    PhoneyDeveloper, I added the following to my .h file and it seems to work.

    Code:
    #import <UIKit/UIGeometry.h>
    Worked in the other app too.

    Thank you for the hint.
     
  6. PhoneyDeveloper macrumors 68040

    PhoneyDeveloper

    Joined:
    Sep 2, 2008
    #6
    Typically your pch file will have

    Code:
    #import <UIKit/UIKit.h> 
    and that will import the UIGeometry header, as well as a whole lot more. Did you change that in some way? Or change a project setting to turn off the pch file?
     
  7. xStep, Oct 15, 2013
    Last edited: Oct 15, 2013

    xStep thread starter macrumors 68000

    Joined:
    Jan 28, 2003
    Location:
    Less lost in L.A.
    #7
    More mystery.

    First, yes I already had;
    Code:
    #import <UIKit/UIKit.h>
    No I don't use custom PCH files and I didn't alter the UIKit.h file. But...

    I went to play with it again tonight and managed to get the error back even with the previous import I mentioned. Uh!

    I noticed I have two iPhone selections for the target. (see attached image) One apparently points to the 6.1 SDK and the other points to the 7.0 SDK. No hint in the selection suggests this. When I choose the first one, I get the error. When I choose the second one the compiler works as expected.

    I don't recall selecting the second one after adding that line, but who really knows now. :confused:

    Is the double iPhone entries caused by having two SDKs installed? YES it is, and they appear in the order of the available and applicable SDKs. Only the newer ones that match or exceed the version of your deployment target will appear.

    Will have to work with other developer on this to see his setup.
     

    Attached Files:

  8. waterskier2007 macrumors 68000

    waterskier2007

    Joined:
    Jun 19, 2007
    Location:
    Novi, MI
    #8
    You sure? Usually this just means you have multiple devices connected to your computer. I have two devices connected frequently, and they both show up in this section of that list, above the simulators
     
  9. xStep thread starter macrumors 68000

    Joined:
    Jan 28, 2003
    Location:
    Less lost in L.A.
    #9
    Waterskier2007,

    Yes, I am sure.

    I did an experiment and added another iOS SDK to both Xcode 4.6.3 and 5. When I did that and restarted and plugged in the iPhone, I saw yet another entry.

    Also note that the name that appears is the name you have given to your device. My other iPhone shows up as iPhoneDev and my iPod has another name. That makes it easy to select the desired device when more than one is plugged in.
     
  10. firewood macrumors 604

    Joined:
    Jul 29, 2003
    Location:
    Silicon Valley
    #10
    Installing the iOS 6.1 SDK in Xcode 5 is unsupported and reported (in Apple's dev forums, login required) to produce buggy builds. I would remove it, and/or reinstall Xcode 5 without it. Install and use Xcode 4.6.x if you need iOS 6.1 SDK builds (you can install two versions of Xcode on your Mac).

    There are plenty of textview and UIView related anomalous behaviors in iOS 7 ( also reported in Apple's dev forums). Try submitting a bug report... it might get marked as a dup though.
     

Share This Page