1

What I am trying to do: I am writing a date and time program (“Date-O-Rama”) for iOS, macOS, and watchOS. (Apple has been getting much nicer about running the same code on different platforms with little or no alterations.) I need more astronomical information, so I decided to add the package SwiftAA (https://github.com/onekiloparsec/SwiftAA).

What actually happens: The best I have managed to do is to get Cocoapods to install SwiftAA for iOS and watchOS, and the code runs on both platforms, including in unit tests. (And it correctly calculates Moon phases, there, too.) However, the macOS (specifically, Mac Catalyst) version of SwiftAA fails to build. Attempting to use it on macOS results in a message of "No such module ‘SwiftAA’” in code. On disk (see picture), it is clear that Xcode has built iOS and watchOS versions of SwiftAA and a related framework it depends on, ObjCAA, but it never builds them for Mac Catalyst.

Generated SwiftAA and ObjCAA on disk

Environment: I am programming in Xcode 12.5.1 on my M1 MacBook Pro running macOS Big Sur 11.5.2. Cocoapods is 1.10.2.

SwiftAA: I am working with version 2.3.0.

Podfile:

# Uncomment the next line to define a global platform for your project
#platform :ios, '14.0'

target 'Date-O-Rama' do
  # Comment the next line if you don't want to use dynamic frameworks
  use_frameworks!

  # Pods for Date-O-Rama
platform :ios, '14.0'
  pod 'SwiftAA'

  target 'Date-O-RamaTests' do
    inherit! :search_paths
    # Pods for testing
  end

  target 'Date-O-RamaUITests' do
    # Pods for testing
  end

end

target 'WatchDate-O-Rama' do
  platform :watchos, '7.0'
  # Comment the next line if you don't want to use dynamic frameworks
  use_frameworks!

  # Pods for WatchDate-O-Rama

end

target 'WatchDate-O-Rama Extension' do
platform :watchos, '7.0'
  # Comment the next line if you don't want to use dynamic frameworks
  use_frameworks!

  # Pods for WatchDate-O-Rama Extension
  pod 'SwiftAA'

end

I feel very confused in that there seems to be nothing in my project that indicates that iOS and Mac Catalyst should be treated any differently, but clearly that is what Xcode is doing. Does anyone have any idea what might be possibly going wrong and how to fix it? Thanks in advance.

UPDATE: I have managed to get my code to run again on macOS: I have to run it as “Designed for iPad”. I can get away with this, as I have an M1 Mac, but I suspect that this might not work for someone using an Intel Mac.

0 Answers0