user3582537 user3582537 - 1 year ago 132
iOS Question

Xcode 7: Conflicting return type in implementation of 'supportedInterfaceOrientations': 'UIInterfaceOrientationMask' vs 'NSUInteger'

I just updated my Xcode to version 7.0 (7A220) and, unfortunately, I got several problems. Let me list those:

  1. Now the images.xcassets provides support only for 1x, 2x, 3x. The Retina 4 2x box still exists for existing images but you cannot add new sets with Retina support. How can I handle that ?

  2. My app doesn't work anymore for iPhone 4* and 5*. Images are disappeared: I can see only text (actually only launchscreen image works). I guessed that I might have had problem with iPhone 5* (No longer support for Retina 4) but I'm surprised about iPhone 4* (I used to create a -480 version of each image and put inside the 2x box). Here the same question: how can I handle that ?

  3. I got several warnings: the first one was about "Update to recommended project settings" (Done but nothing changed).

The second is during runtime:

../ViewController.m:41:1: Conflicting return type in implementation of 'supportedInterfaceOrientations': 'UIInterfaceOrientationMask' (aka 'enum UIInterfaceOrientationMask') vs 'NSUInteger' (aka 'unsigned int')

The third also during runtime:

(null): Directory not found for option '-F/Applications/'

Can someone help me ? I'm using Xcode 7.0 (7A220) with SpriteKit for develop my app.

Answer Source

This is how I solved those problems:

1) Apple seems doesn't support anymore Retina 4. This means that iPhone 4*, iPhone 5* and iPhone 6 need to be placed inside the @2x box. Surely it's trickier to handle fullscreen images, therefore you have to handle all programmatically.

2) I fixed this issue by setting all of the images to "Universal" instead of specific device (iPhone 4S and 5. Don't know why but iPhone 6 worked even with specific device). Anyways, bug or not I've notified Apple.

3a) The return type of the method UIInterfaceOrientationMask has changed, so if you get a warning such as ../ViewController.m:41:1: Conflicting return type in implementation of 'supportedInterfaceOrientations': 'UIInterfaceOrientationMask' (aka 'enum UIInterfaceOrientationMask') vs 'NSUInteger' (aka 'unsigned int') you need to replace the return type.

// Before upgrading
- (NSUInteger)supportedInterfaceOrientations

// After upgrading
- (UIInterfaceOrientationMask)supportedInterfaceOrientations

(Thanks to Rainer Schwarze)

3b) It seems the upgrade created issues in custom framework contexts (correct me if I'm wrong), this can be solved by removing the references from Build Settings.

Items to remove

Hope this could be helpful!

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download