【发布时间】:2012-10-26 08:59:08
【问题描述】:
我想实现一个应用程序,通过该应用程序可以在网络下的两个 iOS 设备之间进行语音和文本聊天。我不需要像 LinPhone 或 SiPhone 这样的任何电话的语音通话功能。我研究过它们,发现对我来说太复杂了。有没有什么简单的 SDK 可以做到这一点???
顺便说一句,用户识别可以通过电子邮件验证来完成......
【问题讨论】:
标签: objective-c ios text chat voice
我想实现一个应用程序,通过该应用程序可以在网络下的两个 iOS 设备之间进行语音和文本聊天。我不需要像 LinPhone 或 SiPhone 这样的任何电话的语音通话功能。我研究过它们,发现对我来说太复杂了。有没有什么简单的 SDK 可以做到这一点???
顺便说一句,用户识别可以通过电子邮件验证来完成......
【问题讨论】:
标签: objective-c ios text chat voice
我认为最好的方法是使用 XMPP 框架。使用 XMPP,您可以将文件和文本发送给其他人。使用它,您可以录制语音消息并将其发送出去。有一些链接:
GitHub Project Link for XMPP Chat
Building a Jabber Client for iOS: XMPP Setup
希望对你有帮助。
编辑:
Apple 的 GameKit 框架提供了实现游戏内聊天所需的一切。
完整的文档在这里:
假设您已经使用 GameKit 将应用程序连接到一个或多个其他玩家,您可以像这样开始语音聊天:
-(void) startInGameChat {
//Set up audio session
AVAudioSession *audioSession = [AVAudioSession sharedInstance];
[audioSession setCategory:AVAudioSessionCategoryPlayAndRecord error:myErr];
[audioSession setActive: YES error: myErr];
GKMatch* match;
GKVoiceChat *teamChannel = [[match voiceChatWithName:@"redTeam"] retain];
GKVoiceChat *allChannel = [[match voiceChatWithName:@"allPlayers"] retain];
//Start the chat
[teamChannel start];
//Enable Mic
teamChannel.active = YES;
}
【讨论】: