-
Notifications
You must be signed in to change notification settings - Fork 20
addPassFromUrl blocks main thread (initWithContentsOfURL) causing UI hangs #42
Description
Summary:\n performs a synchronous network read on the main thread. This can freeze the UI for >2s and trigger App Hang reports.\n\nWhere:\nios/WalletManager.m (addPassFromUrl)\n- The method dispatches to the main queue and calls:\n NSData *data = [[NSData alloc] initWithContentsOfURL:passURL];\n\nSteps to reproduce:\n1) Call addPassFromUrl with a remote https .pkpass URL\n2) On device, UI freezes while the pass is downloaded\n\nExpected:\nNetwork fetch happens off the main thread; UI stays responsive. Only presentation should happen on main.\n\nActual:\nMain-thread synchronous fetch causes UI hang.\n\nSuggested fix:\n- Use NSURLSession/async fetch on a background queue, then dispatch back to main only for PKAddPassesViewController presentation.\n- Alternatively, deprecate addPassFromUrl in favor of showViewControllerWithData(filePath) and document it.\n\nEnvironment:\n- iOS device, real pass URL\n- react-native-wallet-manager 1.1.3\n