This guide helps address common issues that might arise when integrating the THN Native SDK into your iOS or Android application.
Symptoms:
- Blank space where the widget should appear
- Error callbacks being triggered
- No visible content in the widget area
Possible Causes & Solutions:
-
Invalid Property ID
- Ensure your property ID is correct and active
- Verify with THN support that your property is configured correctly
-
Network Connectivity Issues
- Check your device has internet access
- Ensure your app has proper network permissions
- iOS: Check
Info.plistfor network permissions - Android: Verify
INTERNETpermission in your manifest
-
Incorrect Page Type
- Make sure you're using the appropriate
THNPageNamefor the current screen - Different page types display different widgets; using the wrong one may result in no content
- Make sure you're using the appropriate
-
Framework Integration Issues
- iOS: Ensure the framework is properly embedded in your app
- Android: Verify the AAR file is correctly included in your project
Symptoms:
- App crashes when navigating away from the widget screen
- Memory warnings in the console
- Performance degradation over time
Solutions:
-
iOS Memory Management
- Ensure proper lifecycle management of the
THNWidgetLoader - For UIKit, properly remove the widget from view hierarchy when not needed
- For SwiftUI, avoid creating multiple instances of the widget unnecessarily
// In viewWillDisappear: widgetView.removeFromSuperview()
- Ensure proper lifecycle management of the
-
Android Memory Management
- Call
destroy()on the widget when it's no longer needed - Handle configuration changes properly
override fun onDestroy() { super.onDestroy() widgetLoader.destroy() }
- Call
Symptoms:
- Widget is visible but doesn't respond to touch
- Some elements in the widget are not interactive
- Touch events are passed through to views behind the widget
Solutions:
-
iOS Touch Handling
- Ensure the widget view has
userInteractionEnabled = true - Check if any views are overlapping the widget with higher z-index
- Verify
isUserInteractionEnabledis true for parent views
- Ensure the widget view has
-
Android Touch Handling
- Make sure no other views are capturing touch events
- Verify the widget is properly sized and visible
- Check for any transparent overlays that might be intercepting touches
Symptoms:
- Debug mode is enabled but no visual indicators appear
- Console logs not showing in development environment
Solutions:
-
iOS Debug Mode
- Ensure
debugModeparameter is set totrue - Check that the debug console is visible in Xcode
- Use Safari Developer Tools to inspect WebView content
THNWidgetLoader( data: $thnData, error: $error, debugMode: true, // Set debug mode isVisible: $isVisible )
- Ensure
-
Android Debug Mode
- Enable WebView debugging at the application level
- Use Chrome DevTools to inspect WebView content
// In your Application class: override fun onCreate() { super.onCreate() if (BuildConfig.DEBUG) { WebView.setWebContentsDebuggingEnabled(true) } } // When configuring the widget: widgetLoader.configure( data = thnData, debugMode = true, // other parameters )
Symptoms:
- Widget doesn't reflect changes in your data models
- Updates to
THNDataare not visible in the widget
Solutions:
-
iOS Data Binding
- Ensure your SwiftUI
@Stateor@Bindingproperties are working correctly - Create a new THNData instance rather than modifying properties of an existing one
- Verify your update is happening on the main thread
// Instead of modifying properties: // thnData.search?.checkIn = "2023-07-01" // May not trigger update // Create a new instance: thnData = THNData( propertyId: thnData.propertyId, pageName: thnData.pageName, languageCode: thnData.languageCode, currencyCode: thnData.currencyCode, search: THNSearch( checkIn: "2023-07-01", checkOut: thnData.search?.checkOut ?? "" ) )
- Ensure your SwiftUI
-
Android Data Updates
- Use the
updateData()method to refresh the widget - Ensure you're creating a new
THNDatainstance with updated values
// Create updated data val updatedData = THNData( propertyId = currentData.propertyId, pageName = currentData.pageName, // Updated properties search = THNSearch( checkIn = "2023-07-01", checkOut = "2023-07-05" ) ) // Update the widget widgetLoader.updateData(updatedData)
- Use the
Symptoms:
- Widget is not visible even though it's properly initialized
- Widget appears but doesn't show expected content
Solutions:
-
iOS Visibility
- Check that the
isVisiblebinding is set totrue - Verify the widget is properly positioned in your view hierarchy
- Ensure parent views don't have
hidden = trueoropacity = 0
- Check that the
-
Android Visibility
- Check the widget's visibility properties (
View.VISIBLE) - Ensure the widget has proper layout dimensions
- Verify parent layouts aren't hiding the widget
- Check the widget's visibility properties (
Symptoms:
- Widget doesn't show correct dates
- Booking functionality doesn't work as expected
Solutions:
- Ensure all dates are formatted as
"YYYY-MM-DD"(e.g.,"2023-06-15") - Don't use localized date formats or different separators
Always start troubleshooting by enabling debug mode:
iOS:
THNWidgetLoader(
data: $thnData,
error: $error,
debugMode: true,
isVisible: $isVisible
)Android:
widgetLoader.configure(
data = thnData,
debugMode = true,
// other parameters
)Both platforms allow inspecting the WebView content:
iOS:
- Connect your device/simulator to Safari
- Enable Web Inspector in Safari Developer Tools
- Select your app's WebView from the Develop menu
Android:
- Enable
chrome://inspectin Chrome - Connect your device/emulator
- Navigate to the screen with the THN widget
- Select your WebView from the list of targets
Enable verbose logging to see detailed information:
iOS:
// Add an observer for error binding changes
.onChange(of: error) { newError in
if let error = newError {
print("THN Widget Error: \(error.localizedDescription)")
}
}Android:
// Add a custom logger
widgetLoader.configure(
data = thnData,
debugMode = true,
isVisible = { isVisible ->
Log.d("THNWidget", "Visibility changed: $isVisible")
}
)If you're still experiencing problems after trying these solutions:
-
Check our sample applications for reference implementations:
- iOS:
ios/thnnative-ios-sample/ - Android:
android/app/
- iOS:
-
Verify your data models match the expected formats (see DATA_MODELS.md)
-
Contact THN support at tech@thehotelsnetwork.com with:
- Your implementation code
- Detailed error messages/logs
- Steps to reproduce the issue
- Device/OS/SDK version information