Search code examples
swiftipaxcode9

Invalid Bundle structure with a rogue .o file


Trying to validate an archive build with Xcode 9. For some reason Xcode is converting one of my .swift files to a .o file. This causes the validation to fail.

Invalid Bundle Structure - The binary file 'MYAPPNAME.app/TCBConnection.o' is not permitted. Your app can’t contain standalone executables or libraries, other than a valid CFBundleExecutable of supported bundles. Refer to the Bundle Programming Guide at https://developer.apple.com/go/?id=bundle-structure for information on the iOS app bundle structure.

The file shown as TCBConnection.ois in fact a .swift file

The contents of the TCBConnection.swift (shown) file is a wrapper for a Apples Reachability.h/.m Class.

//
// Connection.swift
//
// Created by TCB-iMAC on 24/11/2016.
// Copyright © 2016 TCB-iMAC. All rights reserved.
//

import UIKit

class TCBConnection: NSObject {


@objc class func isConnectedToInternet() -> Bool {

if (Reachability.forInternetConnection().currentReachabilityStatus() == NetworkStatus.NotReachable){

UIApplication.shared.keyWindow?.rootViewController?.present(Reachability.showNoNetworkUIAlertController(), animated: true, completion: {

})

return false
}

return true
}


}

I have a bridging header file for the Reachability.h in my project.

Testing and running the project on a device or simulator all works fine. However for some reason I can not validate the archive as Xcode changes the .swift file to a .o file. Why is this and how I can fix it?


Solution

  • SOLVED: Had to copy (cmd + c) all the content of the TCBConnection.swift file. Delete the file. Make a new file give same name and paste (cmd + v) in the copied text of the deleted file. Problem solved.