In-app Chat
  • iOS : Objective-C
  • Android
  • Web
  • Flutter
  • React Native
  • Unity3D
  • Windows
  • macOS
  • Introduction
    • Overview
    • Basic concepts
  • Sample app
  • Getting started
  • Client SDKs
    • SDK downloads
    • Release notes
    • Upgrade guide
  • Guides
    • Authentication
    • Manage users
    • Room
    • Group
    • Messaging
    • Call invitation (signaling)
    • Manage sessions
  • Offline push notifications
  • Error codes
  • Client APIs
  • Server APIs
  • Documentation
  • In-app Chat
  • Sample app

Sample app

Last updated:2023-09-27 10:16

Sample app
Download

Here we provide you with a sample application to experience ZEGOCLOUD's In-app Chat, and also describe how to run the sample code.

Prerequisites

  • Xcode 7.0 or later.
  • An iOS device or iOS Simulator that is running on iOS 11.0 or later and supports audio and video. We recommend you use a real device.
  • The iOS device is connected to the internet.
  • Contact the ZEGOCLOUD Technical support to get the AppID and ServerSecret for SDK integration.
  • Get the Token that SDK required for login authentication. For details, see Authentication.

Sample code structure

The following structure shows the subdirectory structure of the In-app Chat sample code:

├── CommonTools
│   ├── GHConsole
│   ├── HUD
│   ├── KeyboardToolBar
│   ├── TokenGenerator
│   └── ZEGOPopMenuView
├── Podfile
├── Podfile.lock
├── Pods
│   ├── Headers
│   ├── Local\ Podspecs
│   ├── MJRefresh
│   ├── Manifest.lock
│   ├── Pods.xcodeproj
│   └── Target\ Support\ Files
├── ZIMExampleDemo
│   ├── AppDelegate.h
│   ├── AppDelegate.mm
│   ├── Assets.xcassets
│   ├── Base.lproj
│   ├── ConversationList
│   ├── Group
│   ├── GroupList
│   ├── Info.plist
│   ├── Login
│   ├── Peer
│   ├── Room
│   ├── ZIMExampleDemo.entitlements
│   ├── ZIMManager
│   └── main.m
├── ZIMExampleDemo.xcodeproj
│   ├── project.pbxproj
│   ├── project.xcworkspace
│   └── xcuserdata
├── ZIMExampleDemo.xcworkspace
│   ├── contents.xcworkspacedata
│   ├── xcshareddata
│   └── xcuserdata
└── libs
    └── ZIM.xcframework

Run the sample code

  1. Open AppStore to download the Xcode.

  2. In Xcode, select the File > Open, open the ZIMExampleDemo.xcworkspace file in the extracted sample code package.

  1. Go to SDK downloads to download the latest version of SDK. Copy the unzipped SDK package to the ZIMExampleLegacy/libs/IOS directory.
  1. In Xcode, select the Preferences, click the Accounts tab, click the + button, then select Apple ID, and click Continue.

    /Pics/ZIM/iOS/xcode_preferences.png

  2. Enter your Apple ID and Password to log in.

  3. Modify the Bundle Identifier and certificate.

    1. In Xcode, Select the ZIMExampleDemo project.

      /Pics/ZIM/iOS/xcode_select_project_new.png

    2. Select the target project, click the Signing & Capabilities tab, change the Bundle Identifier configuration and select your own developer certificate in the Team.

      /Pics/ZIM/iOS/team_signing_new.png

  4. Modify the KeyCenter.m file under the ZIMManager folder with the AppID and ServerSecret that you get in the Prerequisites steps.

    + (unsigned int)appID {
        return 1333333333; // Please enter your AppID.
    }
    + (NSString *)Secret{
    return @"Secret"; // Please enter your ServerSecret.
    }
  5. Connect the iOS device to your computer, and select the iOS device in Xcode.

    /Pics/ZIM/iOS/xcode_select_device.png

  6. Click the Build button to run the sample code and experience the In-app Chat service.

    /Pics/ZIM/iOS/build_and_run.png

Page Directory