admin管理员组

文章数量:1122832

I'm trying to run my iOS app on Mac via the "Designed for iPad" destination. It crashes on launch with this:

Failed to look up symbolic reference at 0x1006ac9bd - offset 162835 - symbol symbolic _____y_____GSg 11ActivityKit0A0C 19MyAppPlayerAttributesV in /private/var/folders/4d/wbdrh95d1pz_f5y659dt22gr0000gn/X/6723F443-F2B3-5BE2-99A0-82DA9EF5CB24/d/Wrapper/MyApp.app/MyApphere

This is because ActivityKit isn't available on Mac. However, even if I try to selectively exclude importing ActivityKit I still get the same crash.

//#if os(iOS) || os(watchOS)
#if canImport(ActivityKit)
import ActivityKit
#endif

Also, every part of the code that references ActivityKit is wrapped in a conditional check e.g.:

#if canImport(ActivityKit)

    func startLiveActivity() {
        guard ActivityAuthorizationInfo().areActivitiesEnabled else { return }
        
        let attributes = AudioPlayerAttributes(audioTitle: memoTitle, startDate: Date())
        let initialContentState = AudioPlayerAttributes.ContentState(isPlaying: isPlaying, currentTime: currentTime, duration: duration)
        
        let content = ActivityContent(state: initialContentState, staleDate: nil)
        
        do {
            activity = try Activity.request(attributes: attributes, content: content, pushType: nil)
            print("*** audioPlayer Live Activity started")
        } catch (let error) {
            print("***

本文标签: iosMac Designed for iPad quotFailed to look up symbolic referencequot ActivityKitStack Overflow