Skip to content

Commit

Permalink
finalize objc + swift
Browse files Browse the repository at this point in the history
  • Loading branch information
plutoless committed Jun 9, 2019
1 parent 60aa95c commit 9c23a6b
Show file tree
Hide file tree
Showing 13 changed files with 47 additions and 30 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -7,3 +7,4 @@
//

FOUNDATION_EXPORT NSString *const AppID;
FOUNDATION_EXPORT NSString *const Token;
Original file line number Diff line number Diff line change
Expand Up @@ -9,3 +9,5 @@
#import <Foundation/Foundation.h>

NSString *const AppID = <#Your App ID#>;
//assign token to nil if you have not enabled app certificate, this usually happens to old projects
NSString *const Token = <#Temp Token#>;
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ - (void)setupLocalVideo {
}

- (void)joinChannel {
[self.agoraKit joinChannelByToken:nil channelId:@"demoChannel1" info:nil uid:0 joinSuccess:^(NSString * _Nonnull channel, NSUInteger uid, NSInteger elapsed) {
[self.agoraKit joinChannelByToken:Token channelId:@"demoChannel1" info:nil uid:0 joinSuccess:^(NSString * _Nonnull channel, NSUInteger uid, NSInteger elapsed) {
// Did join channel "demoChannel1"
}];
// The UID database is maintained by your app to track which users joined which channels. If not assigned (or set to 0), the SDK will allocate one and returns it in joinSuccessBlock callback. The App needs to record and maintain the returned value as the SDK does not maintain it.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,12 +30,12 @@ To build and run the sample application, get an App ID:
3. Save the **App ID** from the Dashboard for later use.
4. Generate a temp **Access Token** (valid for 24 hours) from dashboard page with given channel name, save for later use.

4. Open `Agora Mac Tutorial Objective-C.xcodeproj` and edit the `KeyCenter.m` file. Update `<#Your App Id#>` with your app ID.
5. Open `Agora Mac Tutorial Objective-C.xcodeproj` and edit the `AppID.m` file. Update `<#Your App Id#>` with your app ID, and assign the token variable with the temp Access Token generated from dashboard.

```
+ (NSString *)AppId {
return @"Your App ID";
}
NSString *const appID = @"<#Your App ID#>";
// assign token to nil if you have not enabled app certificate, this usually happens to old projects
NSString *const token = @"<#Temp Token#>";
```
### Integrate the Agora Video SDK
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,12 +27,12 @@ QuickStart:
- title: Obtain an App ID
content: |
$_{APPID}
4. Open `Agora Mac Tutorial Objective-C.xcodeproj` and edit the `KeyCenter.m` file. Update `<#Your App Id#>` with your app ID.
5. Open `Agora Mac Tutorial Objective-C.xcodeproj` and edit the `AppID.m` file. Update `<#Your App Id#>` with your app ID, and assign the token variable with the temp Access Token generated from dashboard.
```
+ (NSString *)AppId {
return @"Your App ID";
}
NSString *const appID = @"<#Your App ID#>";
// assign token to nil if you have not enabled app certificate, this usually happens to old projects
NSString *const token = @"<#Temp Token#>";
```
- title: Integrate the Agora Video SDK
content: |
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,11 +30,13 @@
3. 复制后台的 **App ID** 并备注,稍后启动应用时会用到它
4. 在项目页面生成临时 **Access Token** (24小时内有效)并备注,注意生成的Token只能适用于对应的频道名。

4. 将 AppID 填写进 KeyCenter.m
5. 将 AppID 和 Token 填写进 AppID.m

```
static let AppId: String = "Your App ID"
```
```
NSString *const appID = @"<#Your App ID#>";
// 如果你是比较旧的项目,且没有打开Token功能,token可以直接给nil
NSString *const token = @"<#Temp Token#>";
```
### 集成 Agora 视频 SDK
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,11 +27,13 @@ QuickStart:
- title: 创建Agora账号并获取AppId
content: |
$_{APPID}
4. 将 AppID 填写进 KeyCenter.m
5. 将 AppID 和 Token 填写进 AppID.m
```
static let AppId: String = "Your App ID"
```
```
NSString *const appID = @"<#Your App ID#>";
// 如果你是比较旧的项目,且没有打开Token功能,token可以直接给nil
NSString *const token = @"<#Temp Token#>";
```
- title: 集成 Agora 视频 SDK
content: |
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,3 +7,5 @@
//

let AppID: String = <#Your App ID#>
// assign token to nil if you have not enabled app certificate, this usually happens to old projects
let Token: String? = <#Temp Token#>
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ class VideoChatViewController: NSViewController {
}

func joinChannel() {
AgoraKit.joinChannel(byToken: nil, channelId: "demoChannel1", info:nil, uid:0) { (sid, uid, elapsed) -> Void in
AgoraKit.joinChannel(byToken: Token, channelId: "demoChannel1", info:nil, uid:0) { (sid, uid, elapsed) -> Void in
// did join channel "demoChannel1"
}
}
Expand Down
6 changes: 4 additions & 2 deletions One-to-One-Video/Agora-macOS-Tutorial-Swift-1to1/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,10 +29,12 @@ To build and run the sample application, get an App ID:
3. Save the **App ID** from the Dashboard for later use.
4. Generate a temp **Access Token** (valid for 24 hours) from dashboard page with given channel name, save for later use.

4. Open `Agora Mac Tutorial Swift.xcodeproj` and edit the `KeyCenter.swift` file. In the `agoraKit` declaration, update `<#Your App Id#>` with your app ID.
5. Open `Agora Mac Tutorial Swift.xcodeproj` and edit the `AppID.swift` file. In the `agoraKit` declaration, update `<#Your App Id#>` with your app ID, and assign the token variable with the temp Access Token generated from dashboard.

``` Swift
static let AppId: String = <#Your App Id#>
let AppID: String = <#Your App ID#>
// assign Token to nil if you have not enabled app certificate, this usually happens to old projects
let Token: String? = <#Temp Token#>
```

### Integrate the Agora Video SDK
Expand Down
6 changes: 4 additions & 2 deletions One-to-One-Video/Agora-macOS-Tutorial-Swift-1to1/README.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -26,10 +26,12 @@ QuickStart:
- title: Obtain an App ID
content: |
$_{APPID}
4. Open `Agora Mac Tutorial Swift.xcodeproj` and edit the `KeyCenter.swift` file. In the `agoraKit` declaration, update `<#Your App Id#>` with your app ID.
5. Open `Agora Mac Tutorial Swift.xcodeproj` and edit the `AppID.swift` file. In the `agoraKit` declaration, update `<#Your App Id#>` with your app ID, and assign the token variable with the temp Access Token generated from dashboard.
``` Swift
static let AppId: String = <#Your App Id#>
let AppID: String = <#Your App ID#>
// assign Token to nil if you have not enabled app certificate, this usually happens to old projects
let Token: String? = <#Temp Token#>
```
- title: Integrate the Agora Video SDK
content: |
Expand Down
10 changes: 6 additions & 4 deletions One-to-One-Video/Agora-macOS-Tutorial-Swift-1to1/README.zh.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,11 +30,13 @@
3. 复制后台的 **App ID** 并备注,稍后启动应用时会用到它
4. 在项目页面生成临时 **Access Token** (24小时内有效)并备注,注意生成的Token只能适用于对应的频道名。

4. 将 AppID 填写进 KeyCenter.swift
5. 将 AppID 和 Token 填写进 AppID.swift

```
static let AppId: String = "Your App ID"
```
```
let AppID: String = <#Your App ID#>
// 如果你是比较旧的项目,且没有打开Token功能,token可以直接给nil
let Token: String? = <#Temp Token#>
```
### 集成 Agora 视频 SDK
Expand Down
10 changes: 6 additions & 4 deletions One-to-One-Video/Agora-macOS-Tutorial-Swift-1to1/README.zh.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -27,11 +27,13 @@ QuickStart:
- title: 创建Agora账号并获取AppId
content: |
$_{APPID}
4. 将 AppID 填写进 KeyCenter.swift
5. 将 AppID 和 Token 填写进 AppID.swift
```
static let AppId: String = "Your App ID"
```
```
let AppID: String = <#Your App ID#>
// 如果你是比较旧的项目,且没有打开Token功能,token可以直接给nil
let Token: String? = <#Temp Token#>
```
- title: 集成 Agora 视频 SDK
content: |
Expand Down

0 comments on commit 9c23a6b

Please sign in to comment.