coder
coder

Reputation: 29

Capacitor white/black screen

I have just built app with vue and quasar. And I am using capacitor for mobile. On android everything work perfectly on emulator, internal and open testing.

For ios I am facing the issue. I have tested it on macbook emulator and via usb and it is working great.

After that I deployed it to internal and external testing on TestFlight and when I or anyone else run it on iphone it is just black or white screen after splash. Sometimes when I open app its working but then out of nowhere its just showing black or white screen.

I have team set up. On app load there was missing this SplashScreen.hide(). I was getting log in XCode to prolong duration or remove auto hide. I have tried to extend duration etc. but nothing works.

The weird thing is that sometimes just work for a while it but then out of nowhere when I open it, its just black/white screen again.

For example I open app first time and test it and it works. After half an hour I tried again and also work. And then for example for third time I open and just stop working. Its freezed on black/white screen.

I have noticed that when I am in the app and some icons that was preloaded just showing loading spinner instead of icon. And then after that happens I noticed its stop working. I have also tried to remove splashscreen plugin and then is right away when you open the app white/black screen.

capacitor.config:

{
  "appId": "mobileapp",
  "appName": "client app",
  "webDir": "www",
  "server": {
    "androidScheme": "https",
    "iosScheme": "capacitor"
  },
  "ios": {
    "teamId": "1111"
  },
  "plugins": {
    "SplashScreen": {
      "launchShowDuration": 3000,
      "launchAutoHide": true,
      "launchFadeOutDuration": 3000,
      "backgroundColor": "#ffffffff",
      "androidSplashResourceName": "splash",
      "androidScaleType": "CENTER_CROP",
      "splashFullScreen": true,
      "splashImmersive": true,
      "layoutName": "launch_screen",
      "useDialog": true
    }
  }
}

I have also tried to remove server entry but there was no difference.

Info.plist:

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
    <key>CFBundleDevelopmentRegion</key>
    <string>en</string>
    <key>CFBundleDisplayName</key>
    <string>client app</string>
    <key>CFBundleExecutable</key>
    <string>$(EXECUTABLE_NAME)</string>
    <key>CFBundleIdentifier</key>
    <string>$(PRODUCT_BUNDLE_IDENTIFIER)</string>
    <key>CFBundleInfoDictionaryVersion</key>
    <string>6.0</string>
    <key>CFBundleName</key>
    <string>$(PRODUCT_NAME)</string>
    <key>CFBundlePackageType</key>
    <string>APPL</string>
    <key>CFBundleShortVersionString</key>
    <string>$(MARKETING_VERSION)</string>
    <key>CFBundleVersion</key>
    <string>$(CURRENT_PROJECT_VERSION)</string>
    <key>LSRequiresIPhoneOS</key>
    <true/>
    <key>UILaunchStoryboardName</key>
    <string>LaunchScreen</string>
    <key>UIMainStoryboardFile</key>
    <string>Main</string>
    <key>UIRequiredDeviceCapabilities</key>
    <array>
        <string>armv7</string>
    </array>
    <key>UISupportedInterfaceOrientations</key>
    <array>
        <string>UIInterfaceOrientationPortrait</string>
        <string>UIInterfaceOrientationLandscapeLeft</string>
        <string>UIInterfaceOrientationLandscapeRight</string>
    </array>
    <key>UISupportedInterfaceOrientations~ipad</key>
    <array>
        <string>UIInterfaceOrientationPortrait</string>
        <string>UIInterfaceOrientationPortraitUpsideDown</string>
        <string>UIInterfaceOrientationLandscapeLeft</string>
        <string>UIInterfaceOrientationLandscapeRight</string>
    </array>
    <key>UIViewControllerBasedStatusBarAppearance</key>
    <true/>
    
    <!-- App Transport Security settings -->
    <key>NSAppTransportSecurity</key>
    <dict>
        <!-- Allows arbitrary loads for development purposes -->
        <key>NSAllowsArbitraryLoads</key>
        <true/>
        <!-- To be more secure, specify domains instead -->
        <key>NSExceptionDomains</key>
        <dict>
            <!-- Allow localhost for local development -->
            <key>localhost</key>
            <dict>
                <key>NSIncludesSubdomains</key>
                <true/>
                <key>NSExceptionAllowsInsecureHTTPLoads</key>
                <true/>
            </dict>
            <!-- Allow 127.0.0.1 for local development -->
            <key>127.0.0.1</key>
            <dict>
                <key>NSIncludesSubdomains</key>
                <true/>
                <key>NSExceptionAllowsInsecureHTTPLoads</key>
                <true/>
            </dict>
            <!-- Allow any local IP range (for example: 192.168.x.x) -->
            <key>192.168.0.0/16</key>
            <dict>
                <key>NSIncludesSubdomains</key>
                <true/>
                <key>NSExceptionAllowsInsecureHTTPLoads</key>
                <true/>
            </dict>
            <!-- Add more exceptions if necessary -->
        </dict>
    </dict>

</dict>
</plist>

I am trying to resolve this now for a couple of days.

After I added splash screen plugin I opened the app and splash is loaded and after that still white screen. And just stays like that.

On app load it was missing this SplashScreen.hide(). And it worked for a while with that and now out of nowhere when I open it, its just black screen.

I am expecting app to behave normally whenever someone opens it.

Upvotes: 2

Views: 169

Answers (0)

Related Questions