Apple Review is getting rejected repeatedly due the following error:
🍎‼️ Error fetching offerings - The operation couldn’t be completed. (RevenueCat.OfferingsManager.Error error 0.) Underlying error: The request timed out..
This is only happening on Apple Review devices. I’ve tested in Simulator and various physical devices with different iOS versions and cannot reproduce.
Here’s how I initialize RevenueCat:
...
Future<void> initRevenueCat(ProviderContainer container) async {
if (!Platform.isIOS) {
throw UnsupportedError('Unsupported platform for revenuecat');
}
if (kDebugMode) {
await Purchases.setLogLevel(LogLevel.debug);
}
final configuration = PurchasesConfiguration(revenueCatApiKey);
await Purchases.configure(configuration);
Purchases.addCustomerInfoUpdateListener((_) {
container.invalidate(customerInfoProvider);
});
Purchases.setLogHandler(revenueCatHandler);
}
...
Future<void> main() async {
WidgetsFlutterBinding.ensureInitialized();
await Firebase.initializeApp(options: DefaultFirebaseOptions.currentPlatform);
final container = (kProviderDebug)
? ProviderContainer(
observers: [ProviderLogger()],
)
: ProviderContainer();
await initFlutterSettings();
await initAuth(container);
await initAnalytics();
if (defaultTargetPlatform == TargetPlatform.iOS) {
await initRevenueCat(container);
}
runApp(UncontrolledProviderScope(container: container, child: const App()));
}
I tried turning off the internet to see if the timeout is because of that but I get a different error in that case -- `Underlying error: Error performing request because the internet connection appears to be offline..` which is expected.
I have Firebase Crashlytics enabled and found some interesting things:
- The error is occurring for “Process State” “background”
- On the most recent review, one out of the 6 errors was “… internet connection appears to be offline...” but the other 5, and all the reviews before that had the timeout error.
Is this a known issue?
Should I be initializing RevenueCat differently? Maybe only after I’ve confirmed an internet connection?
Should I add any other artifacts to this post?