Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

SwiftUI Won't Preview On FirebaseApp.Configure() #6552

Closed
mhandria opened this issue Sep 24, 2020 · 14 comments
Closed

SwiftUI Won't Preview On FirebaseApp.Configure() #6552

mhandria opened this issue Sep 24, 2020 · 14 comments
Labels
SwiftUI Issues directly related to Apple's SwiftUI framework
Milestone

Comments

@mhandria
Copy link

mhandria commented Sep 24, 2020

[REQUIRED] Describe your environment

  • Xcode version: 11.7 & 12.0
  • Firebase SDK version: 6.33.0
  • Firebase Component: Analytics
  • Component version: 6.33.0
  • Installation method: CocoaPods && SPM

[REQUIRED] Step 2: Describe the problem

There seems to be a problem with SwiftUI preview when I configure Firebase

func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool {
        // Override point for customization after application launch.
        FirebaseApp.configure() //<-----
        return true
}

I've tried deleting DerivedData, removing Pod cache, de-integrating pods, and doing pod update, however, this didn't do anything to solve the issue I have. I have also reinstalled Xcode a few times and upgrading and downgrading between 11.7 and 12.0. The only time SwiftUI preview/Canvas works is when I comment out FirebaseApp.configure(). I also tried using SPM and that didn't help either.

Steps to reproduce:

What happened? How can we make the problem occur?

  • problem is reproducible 100% of the time and it occurs when you click on resume on the SwiftUI preview/canvas view. On the top of the canvas, it says that I "Cannot preview in this file - MyApp app crashed on Launch" and the error is shown below.
    XCode 11.7
The app "MyApp" crashed while updating the preview. Look for crash logs in ~/Library/Logs/DiagnosticReports for more details.

==================================

|  Error Domain=FBSOpenApplicationServiceErrorDomain Code=1 "The request to open "com.clipit.app.ClipIt" failed."
UserInfo={BSErrorCodeDescription=RequestDenied, NSLocalizedDescription=The request to open "com.clipit.app.ClipIt" failed.
, NSUnderlyingError=0x7f8652b4be10 {Error Domain=SketchBoard Code=1 "The application failed to launch" UserInfo={NSLocalizedDescription=The application failed to launch, NSLocalizedFailureReason=The operation couldn’t be completed. Transaction failed.  
Child transaction failed: <FBApplicationUpdateScenesTransaction: 0x6000010893b0> (child transaction), NSUnderlyingError=0x7f8652b4b2d0 {Error Domain=BSTransactionError Code=1 "Transaction failed.  
Child transaction failed: <FBApplicationUpdateScenesTransaction: 0x6000010893b0> (child transaction)" UserInfo={NSLocalizedFailureReason=Transaction failed.  
Child transaction failed: <FBApplicationUpdateScenesTransaction: 0x6000010893b0> (child transaction), precipitating-error=Error Domain=BSTransactionError Code=1 "Transaction failed.  
Child transaction failed: <FBUpdateSceneTransaction: 0x600001610d20> (child transaction)" UserInfo={NSLocalizedFailureReason=Transaction failed.  
Child transaction failed: <FBUpdateSceneTransaction: 0x600001610d20> (child transaction), precipitating-error=Error Domain=BSTransactionError Code=1 "Transaction failed.  
Scene update failed (scene update failed)" UserInfo={NSLocalizedFailureReason=Transaction failed.  
Scene update failed (scene update failed), error-reason=scene update failed,  
error-description=Scene update failed, transaction=<FBUpdateSceneTransaction: 0x600001610d20>},  
error-reason=child transaction,  
error-description=Child transaction failed: <FBUpdateSceneTransaction: 0x600001610d20>,  
transaction=<FBApplicationUpdateScenesTransaction: 0x6000010893b0>}, error-reason=child transaction, error-description=Child transaction failed: <FBApplicationUpdateScenesTransaction: 0x6000010893b0>,  
transaction=<SKBUpdateScenesTransaction: 0x600001ee0e60>}}}},  
FBSOpenApplicationRequestID=0x6eb3, NSLocalizedFailureReason=The request was denied by service delegate (SketchBoard.SketchBoardSystemService).}

XCode 12.0

Error encountered when sending 'prepare' message to agent.

==================================

|  RemoteHumanReadableError: invalid connection
|  
|  com.apple.dt.UITestingAgent (-1):

The preview process appears to have crashed.

Error encountered when sending 'previewInstances' message to agent.

==================================

|  RemoteHumanReadableError: The operation couldn’t be completed. (BSServiceConnectionErrorDomain error 3.)
|  
|  BSServiceConnectionErrorDomain (3):
|  ==BSErrorCodeDescription: OperationFailed

Relevant Code:

https://github.com/mhandria/MyApp.git

@google-oss-bot
Copy link

I found a few problems with this issue:

  • I couldn't figure out how to label this issue, so I've labeled it for a human to triage. Hang tight.
  • This issue does not seem to follow the issue template. Make sure you provide all the required information.

@paulb777
Copy link
Member

paulb777 commented Sep 24, 2020

See #6374 (comment).

If not, we can take a deeper look tomorrow.

@mhandria
Copy link
Author

unfortunately, adding arm64 to the Excluded Architectures didn't solve the issue

@morganchen12 morganchen12 added SwiftUI Issues directly related to Apple's SwiftUI framework and removed needs-triage labels Sep 24, 2020
@paulb777
Copy link
Member

@mhandria
Copy link
Author

So I've tried restarting, re-installing and switching between 11.7 and 12.0 a few times already and it hasn't helped. This crash only happens when I have Firebase.configure() in my AppDelegate.

@mhandria
Copy link
Author

preview won't crash anymore by using ver. 6.30.0 for Firebase

pod 'Firebase/Analytics', '6.30.0'
....
Installing Firebase (6.30.0)
Installing FirebaseAnalytics (6.7.2)
Installing FirebaseCore (6.10.0)
Installing FirebaseCoreDiagnostics (1.5.0)
Installing FirebaseInstallations (1.7.0)
Installing GoogleAppMeasurement (6.7.2)
Installing GoogleDataTransport (7.2.0)
Installing GoogleUtilities (6.7.2)
Installing PromisesObjC (1.2.10)
Installing nanopb (1.30905.0)

@skuske
Copy link

skuske commented Sep 25, 2020

Not here, still crashing with 6.33.0:

Showing Recent Messages
In /X/Pods/Crashlytics/iOS/Crashlytics.framework/Crashlytics(CLSInternalReport.o), building for iOS Simulator, but linking in object file (/X/Pods/Crashlytics/iOS/Crashlytics.framework/Crashlytics(CLSInternalReport.o)) built for iOS, file '/X/Pods/Crashlytics/iOS/Crashlytics.framework/Crashlytics' for architecture arm64

@mhandria
Copy link
Author

I moved my version down to 6.30.0

@skuske
Copy link

skuske commented Sep 25, 2020

@mhandria

Well, wouldn't it be better to leave this issue open then, since the current version is 6.33.0 and not 6.30.0

@paulb777
Copy link
Member

I'll reopen. Since it looks like an Xcode issue, at best, we might be able to investigate workarounds here ...

@paulb777 paulb777 reopened this Sep 25, 2020
@mikebernardo
Copy link

mikebernardo commented Sep 28, 2020

Also seeing this problem.

New SwiftUI project from Xcode template. Add FirebaseAnalytics and FirebaseCrashlytics from SPM or manual ZIP file.

Perhaps this stack trace from ~/Library/Logs/DiagnosticReports is useful:

0   CoreFoundation                      0x000000010a3bf126 __exceptionPreprocess + 242
1   libobjc.A.dylib                     0x000000010a24ff78 objc_exception_throw + 48
2   Foundation                          0x0000000109d0e13b -[NSFileManager contentsOfDirectoryAtURL:includingPropertiesForKeys:options:error:] + 0
3   Dummy2                              0x0000000109160c81 -[GDTCORDirectorySizeTracker calculateDirectoryContentSize] + 369
4   Dummy2                              0x00000001091607e9 -[GDTCORDirectorySizeTracker directoryContentSize] + 105
5   Dummy2                              0x0000000109162f56 __47-[GDTCORFlatFileStorage storeEvent:onComplete:]_block_invoke.60 + 662
6   libdispatch.dylib                   0x000000010b88735b _dispatch_call_block_and_release + 12
7   libdispatch.dylib                   0x000000010b888534 _dispatch_client_callout + 8
8   libdispatch.dylib                   0x000000010b88e425 _dispatch_lane_serial_drain + 715
9   libdispatch.dylib                   0x000000010b88efa0 _dispatch_lane_invoke + 403
10  libdispatch.dylib                   0x000000010b899591 _dispatch_workloop_worker_thread + 782
11  libsystem_pthread.dylib             0x00007fff5dcd8a3d _pthread_wqthread + 290
12  libsystem_pthread.dylib             0x00007fff5dcd7b77 start_wqthread + 15```

@morganchen12
Copy link
Contributor

@mikebernardo are you able to grab the exception message from the stack trace as well?

@paulb777
Copy link
Member

This is #6540 that will be fixed in the next release. The bug was introduced in 6.33.0 so an earlier release could be workaround in the meantime.

@paulb777 paulb777 added this to the 6.34.0 - M81 milestone Sep 28, 2020
@mikebernardo
Copy link

@morganchen12 @paulb777 Yep I revered to 6.32.2 and the problem is gone.

@firebase firebase locked and limited conversation to collaborators Oct 29, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
SwiftUI Issues directly related to Apple's SwiftUI framework
Projects
None yet
Development

No branches or pull requests

6 participants