Sample app
Here we provide you with a sample application to experience ZEGOCLOUD's In-app Chat, and also describe how to run the sample code.
Prepare the enviroment
- 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.
Prerequisites
- Go to ZEGOCLOUD Admin Console, and do the following:
- Create a project, get the AppID and AppSign.
- Subscribe to the In-app Chat service (contact us if the subscription doesn't go well).
For SDK 2.3.0
or later, the AppSign authentication mode and Token-based authentication mode are both supported.
If you want to change your authentication mode, please refer to the Upgrade the authentication mode from using the AppSign to Token.
Get the sample code
The following structure shows the subdirectory structure of the sample code:
...
├── ZIMExampleDemo
│ ├── AppDelegate.h
│ ├── AppDelegate.mm
│ ├── Assets.xcassets
│ ├── Base.lproj
│ ├── CallInvite
│ ├── ConversationList
│ ├── Group
│ ├── GroupList
│ ├── Info.plist
│ ├── Login
│ ├── Peer # One-to-one chat codes
│ ├── Room
│ ├── StartViewController.h
│ ├── StartViewController.m
│ ├── User
│ ├── VideoPlayer.xib
│ ├── ZIMExampleDemo.entitlements
│ ├── ZIMManager # ZIM Instance
│ │ ├── KeyCenter
│ │ │ ├── KeyCenter.h
│ │ │ └── KeyCenter.m # Fill in AppID and AppSign in here
│ │ ├── ...
│ ├── en.lproj
│ ├── main.m
│ └── zh-Hans.lproj
├── ZIMExampleDemo.xcodeproj
│ ├── project.pbxproj
│ ├── project.xcworkspace
│ ├── xcshareddata
│ └── xcuserdata
├── ZIMExampleDemo.xcworkspace
│ ├── contents.xcworkspacedata
│ ├── xcshareddata
│ └── xcuserdata
├── callSound.caf # Voice resource for ringtone customization
└── libs
├── ZIM.xcframework # ZIM SDK. You can replace it with the latest version
└── ZPNs.xcframework # ZPNs SDK. You can replace it with the latest version
Run the sample code
-
Open AppStore to download the Xcode.
-
In Xcode, select the File > Open, open the
ZIMExampleDemo.xcworkspace
file in the extracted sample code package. -
In Xcode, select the Preferences, click the Accounts tab, click the + button, then select Apple ID, and click Continue.
-
Enter your Apple ID and Password to log in.
-
Modify the
Bundle Identifier
and certificate.-
In Xcode, Select the
ZIMExampleDemo
project. -
Select the target project, click the Signing & Capabilities tab, change the
Bundle Identifier
configuration and select your own developer certificate in the Team.
-
-
The sample app is lack of the AppID and AppSign required for SDK initialization. Please fill in the "/ZIMExampleDemo/ZIMExampleDemo/ZIMManager/KeyCenter/KeyCenter.m" file with the AppID and AppSign that you get in the Prerequisites step.
-
Connect the iOS device to your computer, and select the iOS device in Xcode.
-
Click the Build button to run the sample code and experience the In-app Chat service.