Xcode 7.3 Can't archive app

I'm trying to archive my new game to send to the App Store, but Xcode isn't letting me. This is the error that is popping up:

Undefined symbols for architecture armv7:
  "type metadata for (extension in UNDERNEATH):__ObjC.UIScreen.SizeType", referenced from:
      UNDERNEATH.GamePlayScene.creatingPlatforms () -> () in GamePlayScene.o
      function signature specialization <Arg[0] = Owned To Guaranteed> of UNDERNEATH.GamePlayScene.didMoveToView (__ObjC.SKView) -> () in GamePlayScene.o
      function signature specialization <Arg[0] = Dead and Owned To Guaranteed, Arg[1] = Dead and Owned To Guaranteed> of UNDERNEATH.GamePlayScene.touchesBegan (Swift.Set<__ObjC.UITouch>, withEvent : __ObjC.UIEvent?) -> () in GamePlayScene.o
      function signature specialization <Arg[0] = Dead and Owned To Guaranteed> of UNDERNEATH.GameScene.didMoveToView (__ObjC.SKView) -> () in GameScene.o
      function signature specialization <Arg[0] = Dead and Owned To Guaranteed> of UNDERNEATH.EndScene.didMoveToView (__ObjC.SKView) -> () in EndScene.o
ld: symbol(s) not found for architecture armv7
clang: error: linker command failed with exit code 1 (use -v to see invocation)


This is the code I believe the error is referring to:

extension UIScreen {
   
    enum SizeType: CGFloat {
        case Unknown = 0.0
        case iPhone4 = 960.0
        case iPhone5 = 1136.0
        case iPhone6 = 1334.0
        case iPhone6Plus = 1920.0
       
    }
   
    var sizeType: SizeType {
        let height = nativeBounds.height
        guard let sizeType = SizeType(rawValue: height) else { return .Unknown }
        return sizeType
    }
}


Can anyone help me?

Remember, you can't archive if:

- a simulator is selected instead of a device*

- there is an error when building*

- you haven't staged your app as 'Waiting for Upload' in iTunes Connect

- you've recently renewed your (required) apple developer account, and not yet updated the provisions to reflect that activity

* You must have at least one device registered in the Member Center, but it doesn’t have to be connected to your Mac/Xcode when building, in which case select ‘generic iOS/tvOS device'
- - - If this is just about testing to a device and you're getting a message that Xcode can't archive, try deleting all older versions of that app on the target device first

What do you have for your ARCHITECTURES and VALID_ARCHITECTURES settings? Are these different for the Release vs. Debug build schemes? Have you tried doing a Build using the Release scheme? That's what Archive uses.


And of course, have you done a cmd-shift-opt-K (Option - Build->Clean Build Folder)?

Architectures - standard architectures (armv7, arm64) - $(ARCHS_STANDARD)

This one is the same for both Debug and Release


Valid _Architectures - arm64 armv7 armv7s

This one is the same for both Debug and Release




I just tried the clean build folder and still no luck

Accepted Answer

You could try disabling optimization. Here's a thread that looks pretty similar. github.com/AliSoftware/SwiftGen/issues/57#issuecomment-159996671

This worked and helped me. It finally archived! Thank you so much!


But I would also like to ask about this error that appeared after disabling it and trying to archive but before I cleaned the build folder and finally got it to archive. Do you have any idea what this means?


Here is the error:

<unknown>:0: error: virtual filesystem overlay file '/Users/mazdacx9/Library/Developer/Xcode/DerivedData/Ball_Hopping-czpizehyhquslwgmvvehlfvtmggn/Build/Intermediates/ArchiveIntermediates/Ball Hopping/IntermediateBuildFilesPath/Ball Hopping.build/all-product-headers.yaml' not found
<unknown>:0: error: clang importer creation failed


Once again, thank you!

Sorry no, I haven't heard of that one, but if Clean Build Folder made it go away, I wouldn't worry about it. Xcode moves in mysterious ways 😝

Try getting rid of the enum. That's what fixed it for me. Maybe there's a problem with enums in extensions.

Xcode 7.3 Can't archive app
 
 
Q