Skip to main content

Initialization

✅ DO:
  • Initialize in AppDelegate.application(_:didFinishLaunchingWithOptions:) or in your @main App’s init()
  • Enable debug mode when needed for troubleshooting (publisher’s choice)
  • Handle initialization callbacks
❌ DON’T:
  • Initialize inside a view controller or view
  • Initialize multiple times unnecessarily

Ad Loading

✅ DO:
  • Provide meaningful context (prompt, ai response, conversation history)
  • Handle errors gracefully (e.g. hide ad view or show fallback)
  • Track impressions and clicks for analytics
  • Use dimensions in points that match your ad container
❌ DON’T:
  • Use empty or placeholder context when you have real content
  • Block the main thread
  • Ignore error callbacks
  • Use incorrect or zero dimensions

Memory Management

✅ DO:
  • Clear or release ad-related views when they are no longer visible
  • Use weak references where appropriate (e.g. in callbacks)
  • Clean up in deinit or when the view controller is dismissed
❌ DON’T:
  • Keep strong references to ad views after the screen is dismissed

Error Handling

✅ DO:
func onError(error: String) {
    print("Ad error: \(error)")
    // Show fallback content or hide ad space
    hideAdView()
}
❌ DON’T:
  • Ignore errors or crash the app on ad failure