-
Notifications
You must be signed in to change notification settings - Fork 3
Debugging
: debug overlay supports macOS
and visionOS
#422
Conversation
Debugging
: debug overlay supports
macOS and
visionOS`Debugging
: debug overlay supports macOS
and visionOS
da91286
to
1228a9d
Compare
1228a9d
to
0452c93
Compare
Previewstemp/app-store-connect-api-key-configuration.md See contentsYou may upload an App Store Connect API key for RevenueCat to import products and prices from App Store Connect. 1. Create an App Store Connect API keyOn App Store Connect, create a new App Store Connect API key under Users and Access → Keys → App Store Connect API: The newly created key needs to have at least the access level App Manager: Download the generated key. You will receive a .p8 key file. Also take note of the Issuer ID (shown above the "Active" table). 2. Upload the App Store Connect API key to RevenueCatOnce everything is set up in App Store Connect, you need to upload the App Store Connect API key from the previous step to RevenueCat. In the RevenueCat dashboard, select your iOS app from the Apps tab in your project settings. Within your app settings, under the tab App Store Connect API, you'll see an area to upload your App Store Connect .p8 file that you downloaded from App Store Connect. Once you uploaded the in-app purchase .p8 file, you'll see an area to input the Issuer ID that is shown in App Store Connect above the table with the API keys. Remember to select 'Save Changes'. See contents
RevenueCat's SDK will log important information and errors to help you understand what is going on behind the scenes. You can enable more detailed debug logs with the Purchases.logLevel = .debug
Purchases.configure(withAPIKey: <public_sdk_key>, appUserID: <my_app_user_id>) RCPurchases.logLevel = RCLogLevelDebug;
[RCPurchases configureWithAPIKey:@<public_sdk_key> appUserID:@<my_app_user_id>]; Purchases.logLevel = LogLevel.DEBUG
Purchases.configure(PurchasesConfiguration.Builder(context, apiKey = "")
.appUserID(<my_app_user_id>)
.build() Purchases.setLogLevel(LogLevel.DEBUG);
Purchases.configure(new PurchasesConfiguration.Builder(context, <api_key>).appUserID(<my_app_user_id>).build()); Purchases.setLogLevel(Purchases.LOG_LEVEL.DEBUG);
Purchases.configure({
apiKey: "<public_sdk_key>",
appUserID: "<my_app_user_id>",
}); await Purchases.setLogLevel(LogLevel.debug);
PurchasesConfiguration pc = PurchasesConfiguration(<public_sdk_key>);
await Purchases.configure(pc); Purchases.SetLogLevel(Purchases.LogLevel.Debug); Purchases.setLogLevel(LOG_LEVEL.DEBUG);
Debug UIRevenueCat's iOS 4.22.0+ and Android 6.9.2+ SDKs provide an overlay for your app that displays relevant details of the SDK configuration. The debug overlay includes each of your configured Offerings, with the option to purchase any of the products and validate access to entitlements. iOS / macOS / visionOS[block:image] // To display the overlay in SwiftUI, add the `.debugRevenueCatOverlay()` to your view.
// This will display it automatically on app-launch:
ContentView()
.debugRevenueCatOverlay()
// Alternatively, you can control when to present it:
@State private var debugOverlayVisible: Bool = false
var body: some View {
Button {
self.debugOverlayVisible = true
} label: {
Text("Display debug screen")
}
.debugRevenueCatOverlay(isPresented: self.$debugOverlayVisible)
} // To display the overlay in UIKit, use the `presentDebugRevenueCatOverlay` method on any UIViewController:
self.presentDebugRevenueCatOverlay()
// or, initialize the DebugViewController and present it manually:
let debugOverlay = RevenueCat.DebugViewController()
self.present(debugOverlay, animated: true) You can export your configuration details in JSON format to share with RevenueCat support if you need to open a support ticket. Note: The debug UI won't compile for release builds, so you'll need to disable the behavior before archiving for release. Android[block:image] In order to use the overlay, you need to include the debug view library which is available on Maven and can be included via Gradle. Currently, this is only available as a Jetpack Compose Composable. debugImplementation "com.revenuecat.purchase:purchases-debugview:6.9.2"
releaseImplementation "com.revenuecat.purchase:purchases-debugview-noop:6.9.2" Then, you can use it from your own var displayRCDebugMenu by remember { mutableStateOf(false) }
DebugRevenueCatBottomSheet(
onPurchaseCompleted = { /* Handle purchase completion */ },
onPurchaseErrored = { error ->
if (error.userCancelled) { /* Handle purchase cancelled */ }
else { /* Handle purchase error */ }
},
isVisible = displayRCDebugMenu,
onDismissCallback = { displayRCDebugMenu = false }
) Reference
Debug LogsAll logs from the SDK are prepended with " ReferenceEmojis currently available on the following platforms:
[block:parameters] Messages that have the double red exclamation marks prefix ( Sample OutputBelow are sample logs generated when setting
Debugging with HybridsXcode and Android Studio are our recommended IDEs for debugging. If you are a developer who works primarily with one of our hybrid SDKs and have not encountered either before, you can follow these instructions to open your app and find the debug logs to share with RevenueCat Support or your internal team. XcodeInstall Xcode from the App Store.. Within the main folder of your app, you should have a folder titled Android StudioInstall Android Studio from the Google Developers website. You can open the main folder of your app in Android Studio either from the main menu or from your file finder. There shouldn't be any additional editing needed to build and run your app, although you most likely need to set up a virtual Android device when running your app for the first time. The debugging output will open automatically upon building within the Android Studio window, and from here you can follow the instructions above. No and Low Code App BuildersWhen debugging with No and Low Code App Builders, it's important to remember that you'll still need to utilize the specific IDE associated with the device you're targeting. For instance, if you're trying to access debug logs for an app you created using FlutterFlow and you're running it on an iOS device, you'll need to build and run the app through XCode. If you're trying to run it on an Android device, you would need to run it through Android Studio. The process for retrieving debug logs remains the same as explained above. Considerations
Next Steps
|
Fixes RevenueCat/purchases-ios#2648 (comment)