rules_xcodeproj
rules_xcodeproj copied to clipboard
Bug: Xcode Live previews not working
Describe the bug
After generating an .xcodeproj and opening it in Xcode, static canvas previews seem to be working properly, along with automatic preview reloading. However, when a live preview is started, the live preview immediately freezes, and any static previews are broken after that as well.
Reproduction steps
Generate an .xcodeproj using rules_xcodeproj and open it in Xcode. Open any SwiftUI view and try to start a live preview in the canvas.
Expected behavior
Interactive live preview starts.
Versions
- Bazel: rolling
- rules_xcodeproj: 0.7.1
- rules_apple: 1.1.0
- rules_swift: 1.0.0
- xcode: 13.4.1
Additional context
This project includes some dependencies integrated using apple_dynamic_xcframework_import
, apple_static_xcframework_import
, and rules_spm
The error that keeps coming up is
<AppName> crashed due to an uncaught exception `NSGenericException`. Reason: Task created in a session that has been invalidated.
That error doesn't seem related to rules_xcodeproj, but something with the way that your previews are setup: https://stackoverflow.com/questions/60636329/task-created-in-a-session-that-has-been-invalidated
Are you able to test this code in a non-rules_xcodeproj Xcode project?
Yeah, this is a project that we are migrating from Xcode's build system to Bazel, and SwiftUI previews and live previews seem to work properly on the original project.
If you are able to create a self-contained reproduction that I can debug, I would be happy to look into it.
I'm going to close this. If you can provide the self-contained reproduction project I can reopen this and debug further. Btw, recent releases and even main
have improved SwiftUI Previews support, so maybe this is now fixed for you regardless.
Stack trace:
*** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[FBLPromise HTTPBody]: unrecognized selector sent to instance 0x600003711fb0'
*** First throw call stack:
(
0 CoreFoundation 0x000000018040c304 __exceptionPreprocess + 172
1 libobjc.A.dylib 0x000000018005131c objc_exception_throw + 56
2 CoreFoundation 0x000000018041afbc +[NSObject(NSObject) instanceMethodSignatureForSelector:] + 0
3 CoreFoundation 0x0000000180410204 ___forwarding___ + 1308
4 CoreFoundation 0x000000018041268c _CF_forwarding_prep_0 + 92
5 Ergatta 0x00000001011f87c8 -[GDTCCTUploadOperation updateNextUploadTimeWithResponse:forTarget:] + 64
6 Ergatta 0x00000001011f80ac __64-[GDTCCTUploadOperation sendURLRequestWithBatch:target:storage:]_block_invoke + 76
7 Ergatta 0x00000001012171d0 __56-[FBLPromise chainOnQueue:chainedFulfill:chainedReject:]_block_invoke.48 + 52
8 libdispatch.dylib 0x0000000180133fa4 _dispatch_call_block_and_release + 24
9 libdispatch.dylib 0x0000000180135768 _dispatch_client_callout + 16
10 libdispatch.dylib 0x000000018013d9d8 _dispatch_lane_serial_drain + 1260
11 libdispatch.dylib 0x000000018013e43c _dispatch_lane_invoke + 392
12 libdispatch.dylib 0x000000018014a624 _dispatch_workloop_worker_thread + 772
13 libsystem_pthread.dylib 0x00000001ae55eb40 _pthread_wqthread + 284
14 libsystem_pthread.dylib 0x00000001ae55d904 start_wqthread + 8
)
@pswaminathan I'm back from vacation now. To jump start my reproduction, can you share how you integrate with Firebase? A sample project that is an iOS app that integrates in the same way would be really helpful (it would probably reproduce this error even).
Without a repro we can't look into this.
Thanks @brentleyjones — we'll work on getting a repro to you. Back on our radar.
Upgrading Firebase resolved this for us! Looks like this was addressed in google/GoogleDataTransport#146