# ActiveFence Video Content Moderation (/en/realtime-media/marketplace/build/add-moderation-and-intelligence/activefence/ios)

> For AI agents: see the complete documentation index at [llms.txt](/llms.txt).

[ActiveFence](https://www.activefence.com/) provides trust and safety solutions to protect online platforms and their users from malicious behavior and content. By integrating ActiveFence capabilities in your app, you can design the exact content moderation solution you need. Content moderation is powered by AI-driven automated detection for text, audio, image, and video content, enabling you to moderate, enforce policies, manage user flags, and send notifications across multiple abuse areas and languages.

      
  
      
    The following figure shows the ActiveFence workflow to moderate content sent by a specific user to a channel:

    ![ActiveFence workflow](https://assets-docs.agora.io/images/extensions-marketplace/active-fence.svg)

    This page shows you how to integrate and use the ActiveFence content detection and moderation extension in your app.

    ## Prerequisites [#prerequisites-1]

    * Xcode 9.0 or later.
    * A physical device (not an emulator) running iOS 9.0 or later.
    * Implemented the [SDK quickstart](../../../video/quickstart.mdx).
    * If you use RTC SDK tokens, ensure that you are using AccessToken2 to enable ActiveFence video content moderation.

    ## Project setup [#project-setup-1]

    Complete the same ActiveFence account, API key, webhook, and workflow configuration described in the Android section.

    ## Integrate the extension [#integrate-the-extension-1]

    ### Set up your webhook [#set-up-your-webhook-1]

    Create a server that receives and interprets the webhook data, for example with [agora-activefence-kicker](https://github.com/AgoraIO-Community/agora-activefence-kicker).

    ### Initialize `AgoraContentInspectConfig` [#initialize-agoracontentinspectconfig]

    Set up the inspect config inside `ContentInspectManager`. If you use a string UID to join the channel and want to receive it in the webhook callback, pass the string UID to `extraInfo` inside `AgoraContentInspectConfig`.

    ```swift
    var inspectConfig: AgoraContentInspectConfig = {
      let module = AgoraContentInspectModule()
      module.type = .imageModeration
      module.interval = 5

      let config = AgoraContentInspectConfig()
      config.modules = [module]
      config.extraInfo = "YourExtraInfo"
      return config
    }()
    ```

    ### Apply `AgoraContentInspectConfig` [#apply-agoracontentinspectconfig]

    Enable content inspection after joining a channel and after the local video is published and played. To support taking screenshots for multiple video streams and uploading them, use `enableContentInspectEx`.

    ```swift
    self.agoraEngine.enableContentInspect(true, config: self.inspectConfig)
    self.agoraEngine.enableContentInspectEx(enabled, config: config, connection: connection)
    ```

    ### Catch banning events [#catch-banning-events-1]

    ```swift
    func rtcEngine(
      _ engine: AgoraRtcEngineKit,
      connectionChangedTo state: AgoraConnectionState,
      reason: AgoraConnectionChangedReason
    ) {
      if state == .failed, reason == .reasonBannedByServer {
        isBanned = true
      }
    }
    ```

    ## Reference [#reference-1]

    * [Agora Content Inspect Moderation Showcase](https://github.com/AgoraIO-Community/Agora-ActiveFence-iOS)
    * [ActiveFence documentation](https://docs.activefence.com/#section/About-This-Guide)

    
  
      
  
      
  
      
  
