capacitor icon indicating copy to clipboard operation
capacitor copied to clipboard

[Bug]: iOS - Network (?) problems following an iOS update

Open ddx001 opened this issue 1 year ago • 23 comments
trafficstars

Capacitor Version

Latest Dependencies:

@capacitor/cli: 6.1.2 @capacitor/core: 6.1.2 @capacitor/android: 6.1.2 @capacitor/ios: 6.1.2

Installed Dependencies:

@capacitor/android: not installed @capacitor/cli: 6.1.2 @capacitor/core: 6.1.2 @capacitor/ios: 6.1.2

Other API Details

npm --version
10.2.4

node --version
v20.11.1

pod --version
1.13.0

Platforms Affected

  • [X] iOS
  • [ ] Android
  • [ ] Web

Current Behavior

This has been reported in multiple places and a bug was filed here but was closed as unreproducible.

Related bug report: https://github.com/ionic-team/capacitor/issues/7522

Other reports: https://github.com/apache/cordova-ios/issues/1440 https://forum.ionicframework.com/t/experiencing-errors-lately/241278 https://stackoverflow.com/questions/78765347/xcode-ios-app-will-not-load-necp-client-action-get-signed-client-id-80-aut https://stackoverflow.com/questions/78735508/is-there-any-way-to-resolve-host-network-app-id-in-xcode https://discussions.apple.com/thread/255647899?sortBy=best https://www.reddit.com/r/OpenCoreLegacyPatcher/comments/1dz7f05/xcode_errors_with_opencore_mac_61_sonoma/

I have experienced the problem with Firebase on iOS so I created a project to reproduce it.

All calls to Firebase stopped working on iOS (I think this follows an update either to iOS on my device or to MacOS. Not sure which is the culprit).

Error messages:

nw_application_id_create_self NECP_CLIENT_ACTION_GET_SIGNED_CLIENT_ID [80: Authentication error]
Failed to resolve host network app id
Warning: -[BETextInput attributedMarkedText] is unimplemented
Invalidating grant <invalid NS/CF object> failed

Expected Behavior

Used to work, should still work.

Project Reproduction

https://github.com/ddx001/ios-problem

Additional Information

macOS version: 14.6.1 (23G93) iOS version: 17.6.1

See the readme.md file from the reproduction project for setup.

ddx001 avatar Aug 26 '24 20:08 ddx001

I'm encountering the same issue. The app worked fine two weeks ago and was approved in the App Store. However, when running the same app in Xcode 15.4 on a physical iPhone 13 device today , it displays a blank white page on the iPhone. The log (below) shows the same error reported by dx001. The app runs fine in the Xcode Simulator using 17.4 .

I'm using iOS Version 17.16.1 on an iPhone 13 Pro, which was originally released on August 7th and updated again on August 19th by Apple. For more details on the update.

2024-08-28_21-35-12

Update: I suspected this issue might be related to Firebase. So I removed the libraries and all references to capacitor-community/fcm and capacitor/push-notifications, but the error persists.

camtera avatar Aug 29 '24 01:08 camtera

I suspect this issue is related to WKWebView and iOS 17.6, especially since a person with the same problem isn't using Capacitor: https://forums.developer.apple.com/forums/thread/762223

camtera avatar Aug 29 '24 03:08 camtera

Same issue but we are not using firebase

dsk8311 avatar Sep 06 '24 08:09 dsk8311

Same here with Capacitor and Firebase.

natmet avatar Sep 11 '24 03:09 natmet

Yes same issue on iOS 17.6 & i've seen it on iOS 18 too.

Can't confirm if it's firebase related.

Adding some logs from crashes in case they're relevant:

crash on iOS 17.6:

0x1160200c0 - [PID=13373] WebProcessProxy::didClose: (web process 0 crash)
0x1160200c0 - [PID=13373] WebProcessProxy::processDidTerminateOrFailedToLaunch: reason=Crash
Error acquiring assertion: <Error Domain=RBSAssertionErrorDomain Code=2 "Specified target process does not exist" UserInfo={NSLocalizedFailureReason=Specified target process does not exist}>
0x116068480 - ProcessAssertion::acquireSync Failed to acquire RBS assertion 'XPCConnectionTerminationWatchdog' for process with PID=13373, error: (null)
0x10a035418 - [pageProxyID=8, webPageID=9, PID=13373] WebPageProxy::processDidTerminate: (pid 13373), reason=Crash
0x10a035418 - [pageProxyID=8, webPageID=9, PID=13373] WebPageProxy::dispatchProcessDidTerminate: reason=Crash
0x118000a90 - GPUProcessProxy::gpuProcessExited: reason=IdleExit
0x116022340 - [PID=0] WebProcessProxy::gpuProcessExited: reason=IdleExit
Invalidating grant <invalid NS/CF object> failed
Invalidating grant <invalid NS/CF object> failed

crash on iOS 18:

0x1180200c0 - [PID=13446] WebProcessProxy::didClose: (web process 0 crash)
0x1180200c0 - [PID=13446] WebProcessProxy::processDidTerminateOrFailedToLaunch: reason=Crash
Invalidating grant <invalid NS/CF object> failed
0x10a845018 - [pageProxyID=8, webPageID=9, PID=13446] WebPageProxy::processDidTerminate: (pid 13446), reason=Crash
Error acquiring assertion: <Error Domain=RBSServiceErrorDomain Code=1 "((target is not running or doesn't have entitlement com.apple.developer.web-browser-engine.rendering AND target is not running or doesn't have entitlement com.apple.developer.web-browser-engine.networking AND target is not running or doesn't have entitlement com.apple.developer.web-browser-engine.webcontent))" UserInfo={NSLocalizedFailureReason=((target is not running or doesn't have entitlement com.apple.developer.web-browser-engine.rendering AND target is not running or doesn't have entitlement com.apple.developer.web-browser-engine.networking AND target is not running or doesn't have entitlement com.apple.developer.web-browser-engine.webcontent))}>
0x118070300 - ProcessAssertion::acquireSync Failed to acquire RBS assertion 'XPCConnectionTerminationWatchdog' for process with PID=13446, error: (null)
0x10a845018 - [pageProxyID=8, webPageID=9, PID=13446] WebPageProxy::dispatchProcessDidTerminate: reason=Crash
0x119003440 - GPUProcessProxy::gpuProcessExited: reason=IdleExit
0x118022340 - [PID=0] WebProcessProxy::gpuProcessExited: reason=IdleExit
Invalidating grant <invalid NS/CF object> failed
Invalidating grant <invalid NS/CF object> failed

drakedeatonuk avatar Sep 19 '24 07:09 drakedeatonuk

Here are a couple more reported issues that may be related:

https://forum.ionicframework.com/t/app-restart-on-take-photo/243310 https://stackoverflow.com/questions/78677064/cordova-based-app-not-working-after-updating-ios-to-17-5-1

drakedeatonuk avatar Sep 19 '24 09:09 drakedeatonuk

Same issue, XCode 15.4. Using ionic capacitor vue firebase and also a Cordova purchase plugin suggested in ionic docs. Calls to firebase work, for example, I have a Component.vue where firebase services are used for anonymous authentication and they return a valid response. It's just that I have a blank white page (black on emulator)

RKDeveloper12 avatar Oct 02 '24 10:10 RKDeveloper12

Creating a new project via ionic start and then dragging my src folder from previous project to new project ended up working. I had a vue capacitor ionic project with a lot of firebase services.

RKDeveloper12 avatar Oct 08 '24 16:10 RKDeveloper12

I am having the same issue as @drakedeatonuk on iOS 18.0.1 and Capacitor

0x111020680 - [PID=21640] WebProcessProxy::didClose: (web process 0 crash)
0x111020680 - [PID=21640] WebProcessProxy::processDidTerminateOrFailedToLaunch: reason=Crash
Error acquiring assertion: <Error Domain=RBSServiceErrorDomain Code=1 "((target is not running or doesn't have entitlement com.apple.developer.web-browser-engine.rendering AND target is not running or doesn't have entitlement com.apple.developer.web-browser-engine.networking AND target is not running or doesn't have entitlement com.apple.developer.web-browser-engine.webcontent))" UserInfo={NSLocalizedFailureReason=((target is not running or doesn't have entitlement com.apple.developer.web-browser-engine.rendering AND target is not running or doesn't have entitlement com.apple.developer.web-browser-engine.networking AND target is not running or doesn't have entitlement com.apple.developer.web-browser-engine.webcontent))}>
0x1110346c0 - ProcessAssertion::acquireSync Failed to acquire RBS assertion 'XPCConnectionTerminationWatchdog' for process with PID=21640, error: (null)
0x128244c18 - [pageProxyID=10, webPageID=11, PID=21640] WebPageProxy::processDidTerminate: (pid 21640), reason=Crash

brendanowens avatar Oct 16 '24 12:10 brendanowens

Creating a new project via ionic start and then dragging my src folder from previous project to new project ended up working. I had a vue capacitor ionic project with a lot of firebase services.

Facing a similar issue with a vue3/ionic8/capacitor6 project. Curious, when you created a new project and ported your files over, did you also copy the ios and android folders?

treighmawaka avatar Oct 29 '24 13:10 treighmawaka

No, I ended up doing npx cap add ios/android again. Built the dist/public again, synced it, and it worked.

On Tue, 29. Oct 2024 at 15:47, Treigh Mawaka @.***> wrote:

Creating a new project via ionic start and then dragging my src folder from previous project to new project ended up working. I had a vue capacitor ionic project with a lot of firebase services.

Facing a similar issue with a vue3/ionic8/capacitor6 project. Curious, when you created a new project and ported your files over, did you also copy the ios and android folders?

— Reply to this email directly, view it on GitHub https://github.com/ionic-team/capacitor/issues/7631#issuecomment-2444290592, or unsubscribe https://github.com/notifications/unsubscribe-auth/AMNVOX7G3RENVYUKUEZMRBLZ56GXRAVCNFSM6AAAAABNEYS746VHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDINBUGI4TANJZGI . You are receiving this because you commented.Message ID: @.***>

RKDeveloper12 avatar Oct 29 '24 14:10 RKDeveloper12

No, I ended up doing npx cap add ios/android again. Built the dist/public again, synced it, and it worked. On Tue, 29. Oct 2024 at 15:47, Treigh Mawaka @.> wrote: Creating a new project via ionic start and then dragging my src folder from previous project to new project ended up working. I had a vue capacitor ionic project with a lot of firebase services. Facing a similar issue with a vue3/ionic8/capacitor6 project. Curious, when you created a new project and ported your files over, did you also copy the ios and android folders? — Reply to this email directly, view it on GitHub <#7631 (comment)>, or unsubscribe https://github.com/notifications/unsubscribe-auth/AMNVOX7G3RENVYUKUEZMRBLZ56GXRAVCNFSM6AAAAABNEYS746VHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDINBUGI4TANJZGI . You are receiving this because you commented.Message ID: @.>

Got it. Thanks!

treighmawaka avatar Oct 29 '24 14:10 treighmawaka

For me, this was actually just this: https://github.com/ionic-team/capacitor/issues/6663

Which I wish I noticed before I searched for this thread.... because I created a new ionic project then copied it over my project and slow reverted files till I could find which change made the app "stop" loading. I didn't write the app in the first place and don't know why the server code was added.

But removing:

  server: {
    cleartext: true,
    hostname: '0.0.0.0',
  },

from any relelvant capacitor.config.ts fixed it.

ChaseGuru avatar Nov 07 '24 23:11 ChaseGuru

Maybe it was a slightly different issue than #6663? Because I wasn't hard coding localhost, and my issue was specific to production builds on ios 18. The same build worked fine on an ios 17.4 device.

But whatever the case, removing that fixed it.

ChaseGuru avatar Nov 07 '24 23:11 ChaseGuru

@brendanowens @drakedeatonuk If anyone reach for a solution , can share it with us ?

khaled-elrifaay avatar Jan 09 '25 11:01 khaled-elrifaay

I left this problem aside for a while (hoping a solution would come) but now I need this fixed so here is my investigation so far...

I put all the details in the readme of my test project (see: https://github.com/ddx001/ios-problem/blob/main/readme.md) but in a nutshell:

  • I discovered that you can use Safari to get more detailed logs than in Xcode (yes, I'm a noob with iOS).
  • Found out there was a Cross-origin error.
  • Updated capacitor.config.ts to use the Capacitor Http API:
  plugins: {
    CapacitorHttp: {
      enabled: true
    }
  }
  • Then I got: "The resource could not be loaded because the App Transport Security policy requires the use of a secure connection."
  • Updated Info.plist to allow unsecure calls to apis.google.com and developers.google.com (not sure this is a good solution, but it should help with the investigation).
    • see my commit: https://github.com/ddx001/ios-problem/commit/f88078666e41c39ba85d29daf04826b8cc6c576b
  • This has removed the error, but it still doesn't work!!!

I'll keep looking for a solution but this may help some of you to investigate as well so I'm leaving this here.

ddx001 avatar Jan 11 '25 12:01 ddx001

I also added some logs to my example (see commit: https://github.com/ddx001/ios-problem/commit/5533787306df3d7876b94a90226857189c983596).

It shows clearly that Firebase calls don't work properly:

  • Result in 'ionic serve' mode (load then click button):
***** Calling getAuth(initializeApp(...))
***** getAuth(initializeApp(...)) call complete
***** Calling onAuthStateChanged()
***** onAuthStateChanged() call complete
***** onAuthStateChanged() callback null
***** Calling signInAnonymously()
***** onAuthStateChanged() callback _UserImpl {providerId: 'firebase' ...
***** signInAnonymously() call complete
***** Calling signOut()
***** onAuthStateChanged() callback null
***** signOut() call complete
  • Result in iOS (same actions - load then click button):
***** Calling getAuth(initializeApp(...))
***** getAuth(initializeApp(...)) call complete
***** Calling onAuthStateChanged()
***** onAuthStateChanged() call complete
!!! NO CALLBACK, NO ERROR !!!
***** Calling signInAnonymously()
!!! NOTHING HAPPENS, CALL DOESN'T COMPLETE, NO AUTH STATE CHANGED CALLBACK, NO ERRORS !!!

ddx001 avatar Jan 11 '25 13:01 ddx001

From @camtera:

I suspect this issue is related to WKWebView and iOS 17.6, especially since a person with the same problem isn't using Capacitor: https://forums.developer.apple.com/forums/thread/762223

I agree - I'm gonna look into it - according to that post, setting Custom User Agent might solve this.

markemer avatar Feb 10 '25 15:02 markemer

I am facing the same issue. Does anyone have a solution for this?

SamithaKPala avatar Mar 13 '25 18:03 SamithaKPala

Same, yet issues related to "Cloud Firestore couldn't connect to backend" :/

khaelou avatar Apr 14 '25 02:04 khaelou

I was able to temporarily solve this by changing URLSession.shared which limits WebView on iOS 18.3.2 and beyond 👍

khaelou avatar Apr 23 '25 06:04 khaelou

I started seeing this error when I moved Geolocation from @capacitor/geolocation to run earlier (layout onMount). It only silently fails this way when closing and re-opening the app. When I remove the Geolocation plugin the error still happens but it doesn't break behaviour of the app.

EskelCz avatar May 06 '25 22:05 EskelCz

This issue has been labeled as type: bug. This label is added to issues that that have been reproduced and are being tracked in our internal issue tracker.

ionitron-bot[bot] avatar May 22 '25 14:05 ionitron-bot[bot]