UTType always return nil when testing on M1 Mac simulator with x86 arch

(environment: macOS 11.4, Xcode 12.4, iOS simulator 14.4)

The below test does not passed when a project's architectures for "Any iOS Simulator SDK" contains X86_64 only. (Open a new project with architectures arm64 passes)

import UniformTypeIdentifiers

class UTTypeTests: XCTestCase {



    func testThatItConvertsFromMIMEType() {

        if #available(iOS 14.0, *) {

            guard let mp4Type = UTType(mimeType: "video/mp4") else {

                return XCTFail("Could not decode from MIME type.")

            }

            

            XCTAssertEqual(mp4Type, UTType.mpeg4Movie)

        } else {

        }

  }

}

similar issue happens on deprecated method UTTypeCopyPreferredTagWithClass

Replies

Hi yiu por,

This is happening in Xcode 13.2 as well for me. Did you find any solution for this? Not sure if this is in Apple radar already.

Thanks, Vinayak Srivastava

No, the issue is still here. But I rebuild the framework for arm64 simulator and it fixed the issue.