client-sdk-swift
client-sdk-swift copied to clipboard
SwiftUI Previews (in Xcode) Breaking After LiveKit Integration in Swift Package
Describe the bug When I add LiveKit to my Swift Package Module, it results in SwiftUI Previews breaking for that specific Swift Package. No changes to the package content seem to affect this issue; it solely arises when LiveKit is integrated, and is fixed when LiveKit is removed. I've prepared a minimal project below that effectively demonstrates this bug in action.
SDK Version 1.0.13
iOS/macOS Version Xcode (so, simulator) issue
Steps to Reproduce
- Add "LiveKit" dependency to the
AppModulePackage.swift - Try to preview
AppModuleApp.swift
**Note: ** Switch the scheme (target) to AppModule
Expected: it previews like when LiveKit isn't added Actual: it crashes the Preview in Xcode (no import needed)
Screenshots
This is AppModuleApp.swift
** Please let me know if you need more information. I cannot figure out why this is breaking, but it's pretty bad since it greatly reduces dev productivity if we can't use Previews**
** Attached is a test project. Open AppModule/Package.swift and disable LiveKit. You'll be able to run Previews. Then, re-enable LiveKit, and Previews won't work. NO imports needed. **
Logs
== DATE:
Sunday, July 23, 2023 at 8:09:25 PM Eastern Daylight Time
2023-07-24T00:09:25Z
== PREVIEW UPDATE ERROR:
PotentialCrashError: Update failed
XCPreviewAgent may have crashed. Check ~/Library/Logs/DiagnosticReports for any crash logs from your application.
==================================
| RemoteHumanReadableError
|
| LoadingError: failed to load library at path "/Users/jpmcglone/Library/Developer/Xcode/DerivedData/Test-finhwvbigblxjncilbamdngkgqin/Build/Intermediates.noindex/Previews/AppModule/Products/Debug-iphonesimulator/PackageFrameworks/AppModule_-258652ACFE1470_PackageProduct.framework/AppModule_-258652ACFE1470_PackageProduct": Optional(dlopen(/Users/jpmcglone/Library/Developer/Xcode/DerivedData/Test-finhwvbigblxjncilbamdngkgqin/Build/Intermediates.noindex/Previews/AppModule/Products/Debug-iphonesimulator/PackageFrameworks/AppModule_-258652ACFE1470_PackageProduct.framework/AppModule_-258652ACFE1470_PackageProduct, 0x0000): Library not loaded: @rpath/WebRTC.framework/WebRTC
| Referenced from: <84025693-7CBA-3DB6-82E9-BB9AC450CB04> /Users/jpmcglone/Library/Developer/Xcode/DerivedData/Test-finhwvbigblxjncilbamdngkgqin/Build/Intermediates.noindex/Previews/AppModule/Products/Debug-iphonesimulator/PackageFrameworks/AppModule_-258652ACFE1470_PackageProduct.framework/AppModule_-258652ACFE1470_PackageProduct
| Reason: tried: '/Users/jpmcglone/Library/Developer/Xcode/DerivedData/Test-finhwvbigblxjncilbamdngkgqin/Build/Intermediates.noindex/Previews/AppModule/Products/Debug-iphonesimulator/WebRTC.framework/WebRTC' (code signature in <4C4C4490-5555-3144-A1BB-5E94DB878F4F> '/Users/jpmcglone/Library/Developer/Xcode/DerivedData/Test-finhwvbigblxjncilbamdngkgqin/Build/Intermediates.noindex/Previews/AppModule/Products/Debug-iphonesimulator/WebRTC.framework/WebRTC' not valid for use in process: Trying to load an unsigned library), '/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Library/Developer/CoreSimulator/Profiles/Runtimes/iOS.simruntime/Contents/Resources/RuntimeRoot/Users/jpmcglone/Library/Developer/Xcode/DerivedData/Test-finhwvbigblxjncilbamdngkgqin/Build/Intermediates.noindex/Previews/AppModule/Products/Debug-iphonesimulator/PackageFrameworks/PackageFrameworks/WebRTC.framework/WebRTC' (no such file), '/Users/jpmcglone/Library/Developer/Xcode/DerivedData/Test-finhwvbigblxjncilbamdngkgqin/Build/Intermediates.noindex/Previews/AppModule/Products/Debug-iphonesimulator/PackageFrameworks/PackageFrameworks/WebRTC.framework/WebRTC' (no such file), '/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Library/Developer/CoreSimulator/Profiles/Runtimes/iOS.simruntime/Contents/Resources/RuntimeRoot/Users/jpmcglone/Library/Developer/Xcode/DerivedData/Test-finhwvbigblxjncilbamdngkgqin/Build/Intermediates.noindex/Previews/AppModule/Products/Debug-iphonesimulator/PackageFrameworks/PackageFrameworks/WebRTC.framework/WebRTC' (no such file), '/Users/jpmcglone/Library/Developer/Xcode/DerivedData/Test-finhwvbigblxjncilbamdngkgqin/Build/Intermediates.noindex/Previews/AppModule/Products/Debug-iphonesimulator/PackageFrameworks/PackageFrameworks/WebRTC.framework/WebRTC' (no such file), '/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Library/Developer/CoreSimulator/Profiles/Runtimes/iOS.simruntime/Contents/Resources/RuntimeRoot/Users/jpmcglone/Library/Developer/Xcode/DerivedData/Test-finhwvbigblxjncilbamdngkgqin/Build/Intermediates.noindex/Previews/AppModule/Products/Debug-iphonesimulator/PackageFrameworks/PackageFrameworks/WebRTC.framework/WebRTC' (no such file), '/Users/jpmcglone/Library/Developer/Xcode/DerivedData/Test-finhwvbigblxjncilbamdngkgqin/Build/Intermediates.noindex/Previews/AppModule/Products/Debug-iphonesimulator/PackageFrameworks/PackageFrameworks/WebRTC.framework/WebRTC' (no such file), '/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Library/Developer/CoreSimulator/Profiles/Runtimes/iOS.simruntime/Contents/Resources/RuntimeRoot/Users/jpmcglone/Library/Developer/Xcode/DerivedData/Test-finhwvbigblxjncilbamdngkgqin/Build/Intermediates.noindex/Previews/AppModule/Products/Debug-iphonesimulator/PackageFrameworks/PackageFrameworks/WebRTC.framework/WebRTC' (no such file), '/Users/jpmcglone/Library/Developer/Xcode/DerivedData/Test-finhwvbigblxjncilbamdngkgqin/Build/Intermediates.noindex/Previews/AppModule/Products/Debug-iphonesimulator/PackageFrameworks/PackageFrameworks/WebRTC.framework/WebRTC' (no such file), '/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Library/Developer/CoreSimulator/Profiles/Runtimes/iOS.simruntime/Contents/Resources/RuntimeRoot/Users/jpmcglone/Library/Developer/Xcode/DerivedData/Test-finhwvbigblxjncilbamdngkgqin/Build/Intermediates.noindex/Previews/AppModule/Products/Debug-iphonesimulator/PackageFrameworks/PackageFrameworks/WebRTC.framework/WebRTC' (no such file), '/Users/jpmcglone/Library/Developer/Xcode/DerivedData/Test-finhwvbigblxjncilbamdngkgqin/Build/Intermediates.noindex/Previews/AppModule/Products/Debug-iphonesimulator/PackageFrameworks/PackageFrameworks/WebRTC.framework/WebRTC' (no such file), '/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Library/Developer/CoreSimulator/Profiles/Runtimes/iOS.simruntime/Contents/Resources/RuntimeRoot/Users/jpmcglone/Library/Developer/Xcode/DerivedData/Test-finhwvbigblxjncilbamdngkgqin/Build/Intermediates.noindex/Previews/AppModule/Products/Debug-iphonesimulator/PackageFrameworks/PackageFrameworks/WebRTC.framework/WebRTC' (no such file), '/Users/jpmcglone/Library/Developer/Xcode/DerivedData/Test-finhwvbigblxjncilbamdngkgqin/Build/Intermediates.noindex/Previews/AppModule/Products/Debug-iphonesimulator/PackageFrameworks/PackageFrameworks/WebRTC.framework/WebRTC' (no such file), '/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Library/Developer/CoreSimulator/Profiles/Runtimes/iOS.simruntime/Contents/Resources/RuntimeRoot/Users/jpmcglone/Library/Developer/Xcode/DerivedData/Test-finhwvbigblxjncilbamdngkgqin/Build/Intermediates.noindex/Previews/AppModule/Products/Debug-iphonesimulator/PackageFrameworks/PackageFrameworks/WebRTC.framework/WebRTC' (no such file), '/Users/jpmcglone/Library/Developer/Xcode/DerivedData/Test-finhwvbigblxjncilbamdngkgqin/Build/Intermediates.noindex/Previews/AppModule/Products/Debug-iphonesimulator/PackageFrameworks/PackageFrameworks/WebRTC.framework/WebRTC' (no such file), '/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Library/Developer/CoreSimulator/Profiles/Runtimes/iOS.simruntime/Contents/Resources/RuntimeRoot/Users/jpmcglone/Library/Developer/Xcode/DerivedData/Test-finhwvbigblxjncilbamdngkgqin/Build/Intermediates.noindex/Previews/AppModule/Products/Debug-iphonesimulator/PackageFrameworks/PackageFrameworks/WebRTC.framework/WebRTC' (no such file), '/Users/jpmcglone/Library/Developer/Xcode/DerivedData/Test-finhwvbigblxjncilbamdngkgqin/Build/Intermediates.noindex/Previews/AppModule/Products/Debug-iphonesimulator/PackageFrameworks/PackageFrameworks/WebRTC.framework/WebRTC' (no such file), '/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Library/Developer/CoreSimulator/Profiles/Runtimes/iOS.simruntime/Contents/Resources/RuntimeRoot/Users/jpmcglone/Library/Developer/Xcode/DerivedData/Test-finhwvbigblxjncilbamdngkgqin/Build/Intermediates.noindex/Previews/AppModule/Products/Debug-iphonesimulator/PackageFrameworks/PackageFrameworks/WebRTC.framework/WebRTC' (no such file), '/Users/jpmcglone/Library/Developer/Xcode/DerivedData/Test-finhwvbigblxjncilbamdngkgqin/Build/Intermediates.noindex/Previews/AppModule/Products/Debug-iphonesimulator/PackageFrameworks/PackageFrameworks/WebRTC.framework/WebRTC' (no such file), '/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Library/Developer/CoreSimulator/Profiles/Runtimes/iOS.simruntime/Contents/Resources/RuntimeRoot/Users/jpmcglone/Library/Developer/Xcode/DerivedData/Test-finhwvbigblxjncilbamdngkgqin/Build/Intermediates.noindex/Previews/AppModule/Products/Debug-iphonesimulator/PackageFrameworks/PackageFrameworks/WebRTC.framework/WebRTC' (no such file), '/Users/jpmcglone/Library/Developer/Xcode/DerivedData/Test-finhwvbigblxjncilbamdngkgqin/Build/Intermediates.noindex/Previews/AppModule/Products/Debug-iphonesimulator/PackageFrameworks/PackageFrameworks/WebRTC.framework/WebRTC' (no such file), '/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Library/Developer/CoreSimulator/Profiles/Runtimes/iOS.simruntime/Contents/Resources/RuntimeRoot/Users/jpmcglone/Library/Developer/Xcode/DerivedData/Test-finhwvbigblxjncilbamdngkgqin/Build/Intermediates.noindex/Previews/AppModule/Products/Debug-iphonesimulator/PackageFrameworks/PackageFrameworks/WebRTC.framework/WebRTC' (no such file), '/Users/jpmcglone/Library/Developer/Xcode/DerivedData/Test-finhwvbigblxjncilbamdngkgqin/Build/Intermediates.noindex/Previews/AppModule/Products/Debug-iphonesimulator/PackageFrameworks/PackageFrameworks/WebRTC.framework/WebRTC' (no such file), '/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Library/Developer/CoreSimulator/Profiles/Runtimes/iOS.simruntime/Contents/Resources/RuntimeRoot/Users/jpmcglone/Library/Developer/Xcode/DerivedData/Test-finhwvbigblxjncilbamdngkgqin/Build/Intermediates.noindex/Previews/AppModule/Products/Debug-iphonesimulator/PackageFrameworks/PackageFrameworks/WebRTC.framework/WebRTC' (no such file), '/Users/jpmcglone/Library/Developer/Xcode/DerivedData/Test-finhwvbigblxjncilbamdngkgqin/Build/Intermediates.noindex/Previews/AppModule/Products/Debug-iphonesimulator/PackageFrameworks/PackageFrameworks/WebRTC.framework/WebRTC' (no such file), '/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Library/Developer/CoreSimulator/Profiles/Runtimes/iOS.simruntime/Contents/Resources/RuntimeRoot/usr/lib/swift/WebRTC.framework/WebRTC' (no such file), '/usr/lib/swift/WebRTC.framework/WebRTC' (no such file, not in dyld cache), '/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Library/Developer/CoreSimulator/Profiles/Runtimes/iOS.simruntime/Contents/Resources/RuntimeRoot/System/Library/Frameworks/WebRTC.framework/WebRTC' (no such file))
== VERSION INFO:
Tools: 14E300c
OS: 22F82
PID: 72451
Model: MacBook Pro
Arch: arm64e
== ENVIRONMENT:
openFiles = [
/Users/jpmcglone/Desktop/Project Test/Test/AppModule/Sources/AppModule/AppModuleApp.swift
]
wantsNewBuildSystem = true
newBuildSystemAvailable = true
activeScheme = AppModule
activeRunDestination = iPhone 14 Pro variant iphonesimulator arm64
workspaceArena = [x]
buildArena = [x]
buildableEntries = [
AppModule
AppModule
]
== SELECTED RUN DESTINATION:
name = iPhone 14 Pro
eligible = true
sdk = Optional(<DVTSDK:0x13960ff60:'iphonesimulator16.4':Simulator - iOS 16.4:<DVTFilePath:0x600000219030:'/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator16.4.sdk'>>)
variant = Optional("iphonesimulator")
device = Optional(<DVTiPhoneSimulator: 0x15975de30> {
SimDevice: iPhone 14 Pro (5B24B601-A03F-4143-9723-68E4D72E9A92, iOS 16.4, Shutdown)
})
== SELECTED RUN DESTINATION:
Simulator - iOS 16.4 | iphonesimulator | arm64 | iPhone 14 Pro | no proxy
Destination Preferences {
platform: iphonesimulator
platformSpecifier: iphonesimulator
deviceName: iPhone 14 Pro
deviceSpecifier: com.apple.CoreSimulator.SimDeviceType.iPhone-14-Pro
deviceModel: iPhone 14 Pro
deviceIdentifier: 5B24B601-A03F-4143-9723-68E4D72E9A92
deviceFamily: (Device Family: iPhone)
sdkVariant: iphonesimulator
architecture: arm64
sdkSpecifier: /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator16.4.sdk
sdkVersion: 16.4
runtimeVersion: 16.4
}
Proxy:
Destination Preferences {
}
== SESSION GROUP 7595:
workspace identifier: WorkspaceIdentifier(identifier: 40C3D097-9C62-496C-BE05-18A21B868D21)
providers: [
AppModuleApp_Previews /Users/jpmcglone/Desktop/Project Test/Test/AppModule/Sources/AppModule/AppModuleApp.swift
]
translation units: [
/Users/jpmcglone/Desktop/Project Test/Test/AppModule/Sources/AppModule/AppModuleApp.swift
]
attributes: EditorSettingsCollection(storage: [PreviewsPipeline.EditorIdentifier(id: 7502): PreviewsPipeline.EditorSettings(defaultPreviewSettings: PreviewsPipeline.PreviewSettings(storage: [ObjectIdentifier(0x00000002a900ee10): PreviewsPipeline.PreviewSettings.(unknown context at $2a8fcbad4).ValueBox(value: false, isEqual: (Function), isDefaultValue: false), ObjectIdentifier(0x00000002a900ede0): PreviewsPipeline.PreviewSettings.(unknown context at $2a8fcbad4).ValueBox(value: true, isEqual: (Function), isDefaultValue: false)]), appPreviewDestinationRequirements: PreviewsPipeline.DestinationRequirements(rule: PreviewsPipeline.DestinationRequirements.(unknown context at $2a8fbea34).Rule.none), isAppPreviewEnabled: false, _isLightboxEnabled: PreviewsFoundation.UserDefault<Swift.Bool>(key: "UVCanvasEnablePreviewShowAll", cachedValue: false, encoder: Foundation.JSONEncoder), suppressAppPreviewWhenPreviewProvidersArePresent: false, storage: [:])])
session: 7596
request sessions: [
App Module App | AppModuleApp_Previews: not completed
]
== UPDATE SESSION 7596:
Start Date: Sunday, July 23, 2023 at 8:07:06 PM Eastern Daylight Time
Preview Provider {
Simulator {
platform: iphonesimulator
device: 328F5554-9936-40DD-8184-B6DB4E1F9AF2 iPhone 14 Pro
buildNumber: 20E247
runtimePath: /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Library/Developer/CoreSimulator/Profiles/Runtimes/iOS.simruntime
}
pid: 83537
host bundle:
com.apple.dt.PreviewAgent.iOS {
url: file:///Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/Library/Xcode/Agents/XCPreviewAgent.app
version: 20.30.47
attributes: [
AppExtensionIdentifierPreviewAttributeKey: nil,
LaunchConfigEnvironmentVariablesPreviewAttributesKey: ["PACKAGE_RESOURCE_BUNDLE_URL": "/Users/jpmcglone/Library/Developer/Xcode/DerivedData/Test-finhwvbigblxjncilbamdngkgqin/Build/Intermediates.noindex/Previews/AppModule/Products/Debug-iphonesimulator", "__XPC_DYLD_FRAMEWORK_PATH": "/Users/jpmcglone/Library/Developer/Xcode/DerivedData/Test-finhwvbigblxjncilbamdngkgqin/Build/Intermediates.noindex/Previews/AppModule/Products/Debug-iphonesimulator", "DYLD_INSERT_LIBRARIES": "/System/Library/PrivateFrameworks/LiveExecutionResultsProbe.framework/LiveExecutionResultsProbe", "OS_ACTIVITY_DT_MODE": "YES", "DYLD_LIBRARY_PATH": "/Users/jpmcglone/Library/Developer/Xcode/DerivedData/Test-finhwvbigblxjncilbamdngkgqin/Build/Intermediates.noindex/Previews/AppModule/Products/Debug-iphonesimulator", "DYLD_FRAMEWORK_PATH": "/Users/jpmcglone/Library/Developer/Xcode/DerivedData/Test-finhwvbigblxjncilbamdngkgqin/Build/Intermediates.noindex/Previews/AppModule/Products/Debug-iphonesimulator", "__XCODE_BUILT_PRODUCTS_DIR_PATHS": "/Users/jpmcglone/Library/Developer/Xcode/DerivedData/Test-finhwvbigblxjncilbamdngkgqin/Build/Intermediates.noindex/Previews/AppModule/Products/Debug-iphonesimulator", "__XPC_DYLD_LIBRARY_PATH": "/Users/jpmcglone/Library/Developer/Xcode/DerivedData/Test-finhwvbigblxjncilbamdngkgqin/Build/Intermediates.noindex/Previews/AppModule/Products/Debug-iphonesimulator", "SQLITE_ENABLE_THREAD_ASSERTIONS": "1"],
]
}
}
Build Graph {
target dynamicPackageProduct AppModule (#1)
target dynamicPackageProduct AppModule (#2)
target dynamicPackageProduct LiveKit (#3)
target dynamicPackageProduct LiveKit (#4)
target dynamicPackageProduct SwiftProtobuf (#5)
target dynamicPackageProduct SwiftProtobuf (#6)
target dynamicPackageProduct Promises (#7)
target dynamicPackageProduct Promises (#8)
target dynamicPackageProduct FBLPromises (#9)
target dynamicPackageProduct Logging (#10)
target dynamicPackageProduct Logging (#11)
Preview Provider App Module App App Module App (#12)
translationUnit AppModuleApp.swift (#13)
}
Update Plan {
iOS [arm64 iphonesimulator16.4 iphonesimulator] (iPhone 14 Pro, 5B24B601-A03F-4143-9723-68E4D72E9A92-iphonesimulator16.4-arm64-iphonesimulator), ["AppModule", "AppModule"], thinning disabled) {
Destination: iPhone 14 Pro 5B24B601-A03F-4143-9723-68E4D72E9A92 | default device for iphonesimulator [
Framework Agent - Previews {
execution points [
provider AppModule.AppModuleApp_Previews
]
translation units [
AppModuleApp.swift (in AppModule)
]
loadable products [
Description(buildableName: "AppModule", moduleName: "AppModule")
]
modules [
AppModule
FBLPromises
LiveKit
Logging
Promises
SwiftProtobuf
]
}
]
}
}
== POWER STATE LOGS:
7/23/2023, 7:53 PM Received power source state: Battery Powered (lowPowerMode: false, status: charged, level: 100%)
7/23/2023, 7:53 PM No device power state user override user default value.Current power state: Full Power