DeepWall 2.4.6

DeepWall 2.4.6

Burak YalcinSamcro 维护。



DeepWall 2.4.6

  • Teknasyon

DeepWall

Platform Cocoapods

端到端解决方案,用于构建、管理和维护提供内购的盈利性移动应用。

安装

CocoaPods

CocoaPods 是 Cocoa 项目的依赖管理器。有关使用和安装说明,请访问他们的网站。

DeepWall 通过 CocoaPods 可用。要安装它,请在您的 Podfile 中添加以下行。

  1. 添加 DeepWall pod。
use_frameworks!

pod 'DeepWall'
  1. 运行 pod installpod update
  2. 然后,您可以通过将 import DeepWall 添加到项目文件中,来使用 DeepWall。

使用

初始化

import DeepWall

let yourApiKey = "{YOUR_API_KEY}"
let environment: DeepWallEnvironment = .sandbox
DeepWall.initialize(apiKey: yourApiKey, environment: environment)

{YOUR_API_KEY}替换为您的应用令牌。您可以在您的仪表板中找到此密钥。

根据您是为测试还是为生产构建应用程序,您必须使用以下值之一设置环境

let environment: DeepWallEnvironment = .sandbox
let environment: DeepWallEnvironment = .production

重要

在测试您的应用程序时,此值应设置为.sandbox。在发布应用程序之前,请务必将环境设置为.production

我们使用此环境来区分来自测试设备的真实流量和测试流量。始终保持此值具有意义非常重要!

配置

DeepWall需要以下用户属性进行定位。

  • UUID: String
    • 指定用户配置文件或设备的唯一标识符。
  • 国家: DeepWallCountry
    • 双字母国家代码 -- ISO 3166-1 alpha-2
    • 用法: DeepWallCountryManager.getCountry(by: "TR") // TURKEY
  • 语言: DeepWallLanguage
    • 双字母语言代码 -- ISO 639-1
    • 用法: DeepWallLanguageManager.getLanguage(by: "tr") // TURKISH
  • 环境样式: DeepWallEnvironmentStyle
    • 用于付费墙外观的环境样式。
      • automatic: 使用系统外观(默认值)
      • light: 明亮外观
      • dark: 深色外观
  • 调试广告属性: DeepWallAdvertiseAttributions
    • 用于调试目的的广告属性信息。
    • 用法: let attribution = ["debug_attribution: "debug_campaign_attribution"]

重要

在请求任何付费墙之前,您必须调用setUserProperties方法。

let userProperties = DeepWallUserProperties(uuid: uuid, country: country, language: language, debugAdvertiseAttributions: debugAttributions)

DeepWall.shared.setUserProperties(userProperties)

更新用户属性

您可以使用DeepWall.shared.updateUserProperties()方法更新以下用户属性。

func updateUserProperties(country: DeepWallCountry? = nil,
			  language: DeepWallLanguage? = nil,
			  environmentStyle: DeepWallEnvironmentStyle? = nil,
			  debugAdvertiseAttributions: DeepWallAdvertiseAttributions = nil)

请求付费墙

为了成功显示页面,强烈建议在发送页面请求之前等待DeepWall.shared.readyStatus

您可以使用带有代码action参数的requestPaywall方法来显示付费墙。

// SomeUIViewController.swift

DeepWall.shared.requestPaywall(action: "{ACTION_KEY}", in: self)

{ACTION_KEY}替换为您的相关操作键。您可以在您的仪表板中找到或创建操作键。

发送额外数据

您还可以使用extraData参数来向付费墙发送额外数据。

// SomeUIViewController.swift

let deepwallExtraData: DeepWallExtraDataType = [
    "some": "value"
]
DeepWall.shared.requestPaywall(action: "{ACTION_KEY}", in: self, extraData: deepwallExtraData)

关闭付费墙

您可以使用closePaywall方法来关闭付费墙。

DeepWall.shared.closePaywall()

请求展示跟踪提示

您可以使用带有action参数的requestAppTracking方法来显示展示跟踪提示。

// SomeUIViewController.swift

DeepWall.shared.requestAppTracking(action: "{ACTION_KEY}", in: self)

{ACTION_KEY}替换为您的相关操作键。您可以在您的仪表板中找到或创建操作键。

事件处理

DeepWall根据...发布一些各种事件。

  • deepWallPaywallRequested

    • 在付费墙请求后触发。对于在您的应用程序中显示加载指示器非常有用。
  • deepWallPaywallResponseReceived

    • 在收到付费墙响应后触发。对于在您的应用程序中隐藏加载指示器非常有用。
  • deepWallPaywallOpened

    • 付费墙打开事件
    • 参数
      • pageId: Int
  • deepWallPaywallNotOpened

    • 付费墙未打开事件。仅在错误情况下触发。
    • 参数
      • pageId: Int
  • deepWallPaywallActionShowDisabled

    • 付费墙操作显示禁用事件。
      • 参数
        • pageId: Int
  • deepWallPaywallClosed

    • 付费墙关闭事件
    • 参数
      • pageId: Int
  • deepWallPaywallResponseFailure

    • 付费墙响应失败事件
    • 参数
      • errorCode: String
      • reason: String
  • deepWallPaywallPurchasingProduct

    • 付费墙购买产品事件
    • 参数
      • productCode: String
  • deepWallPaywallPurchaseSuccess

    • 购买成功事件。如果Ploutos服务活跃,将在收据验证后触发。
    • 参数
      • type: PloutosValidationType
      • result: PLPurchaseResponse
        • subscriptions: Array of SubscriptionItem
        • products: Array of ProductItem
  • deepWallPaywallPurchaseFailed

    • 购买失败事件
    • 参数
      • productCode: String
      • reason: String
      • errorCode: String
      • isPaymentCancelled: Bool
  • deepWallPaywallRestoreSuccess

    • 恢复成功事件
  • deepWallPaywallRestoreFailed

    • 恢复失败事件
    • 参数
      • reason: RestoreFailedReason
        • .noReceipt
        • .failed
      • errorCode: String
      • errorText: String?
      • isPaymentCancelled: Bool
  • deepWallPaywallExtraDataReceived

    • 接收到额外数据事件
    • 参数
      • DeepWallExtraDataType 模型
  • deepWallATTStatusChanged

    • ATT状态改变事件

用法示例

首先将您的类实现DeepWallNotifierDelegate协议。然后您可以使用observeEvents方法来观察事件。

DeepWall.shared.observeEvents(for: self)

为了移除观察者,您可以使用removeObserver方法。

DeepWall.shared.removeObserver(for: self)

要求

  • iOS 10.0+
  • Xcode 11.0+
  • Swift 5.0+

迁移指南

附加功能

  • 支持暗黑模式
  • 应用内自动购买流程