How to implement voice & text chat between two iOS device

别说谁变了你拦得住时间么 提交于 2019-12-21 06:31:10

问题


I want to implement an app by which voice & text chat between two iOS devcices under a network become possible. I dont need voice call facility to any phone like LinPhone or SiPhone. I have studied over them & found too complex for me. Is there any simple SDK to make this possible???

By the way, user identification may be done by e-mail verification....


回答1:


I think one best way to do it using XMPP Framework. Using XMPP you can send files & text to other persons. Using it you can record voice message & send it across. There are some links for it:

GitHub Project Link for XMPP Chat

Building a Jabber Client for iOS: XMPP Setup

Hope it helps to you.

EDIT:

Apple's GameKit framework provides evertyhing you need to implement in-game chat.

The full documentation is here:

http://developer.apple.com/library/ios/#documentation/NetworkingInternet/Conceptual/GameKit_Guide/AddingVoiceChattoaMatch/AddingVoiceChattoaMatch.html#//apple_ref/doc/uid/TP40008304-CH11-SW11

Assuming you have allready connected the App to one or more other players using GameKit, you can start the voice chat like so:

-(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;

}


来源:https://stackoverflow.com/questions/13250498/how-to-implement-voice-text-chat-between-two-ios-device

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!