小编Kei*_*OYS的帖子

XMPPFramework - 创建XMPPRoom

我一直在尝试使用下面提到的代码创建一个XMPPRoom,我已经在线查看了各种示例,但是当我使用此代码时,委托xmppRoomDidCreate或xmppRoomDidJoin委托不会被调用.我不确定我在这里做错了什么?

PS:xmppStream的代表被调用,它被连接并授权,但问题是XMPPRoom委托...

- (void)createChatRoom
{
    NSString *jabberID = @"abcxyz@testservice.com";
    self.xmppStream.hostName = @"testservice.com";


    self.xmppStream = [[XMPPStream alloc]init];
    [self.xmppStream addDelegate:self delegateQueue:dispatch_get_main_queue()];

    [self.xmppStream setMyJID:[XMPPJID jidWithString:jabberID]];

    NSError *error = nil;

    if (![self.xmppStream connectWithTimeout:XMPPStreamTimeoutNone error:&error]) {
        UIAlertView *alert = [[UIAlertView alloc]initWithTitle:@"Error" message:[NSString stringWithFormat:@"Cannot connect to server %@",[error localizedDescription]] delegate:self cancelButtonTitle:@"Ok" otherButtonTitles:nil];
        [alert show];

        return;
    }

    // Configure xmppRoom
    XMPPJID *roomJID = [XMPPJID jidWithString:@"TestRoom@conference.testservice.com"];

    XMPPRoomMemoryStorage *roomMemoryStorage = [[XMPPRoomMemoryStorage alloc] init];

    XMPPRoom *xmppRoom = [[XMPPRoom alloc] initWithRoomStorage:roomMemoryStorage
                                                           jid:roomJID
                                                 dispatchQueue:dispatch_get_main_queue()];

    [xmppRoom activate:self.xmppStream];
    [xmppRoom addDelegate:self delegateQueue:dispatch_get_main_queue()];
}
Run Code Online (Sandbox Code Playgroud)

xmpp objective-c ios xmppframework

1
推荐指数
1
解决办法
4760
查看次数

XMPPFramework - 如何接收名册的在线信息以及名单列表?

需要帮助获取有关好友的状态信息的信息.

我正在调用"fetchRoster"函数,但是我正在获取名单列表但不是存在信息.

此外,我尝试显式调用显示的存在信息.但在我的iOS应用程序中没有调用didRecievePresence委托.

问候,Cbhat

xmpp objective-c ios xmppframework

1
推荐指数
1
解决办法
3642
查看次数

如何在Java中打印出数组的偶数索引?

我应该用for循环编写一个程序来打印出我的数组的偶数索引.例如,如果我创建一个包含10个数字的数组,它将具有0-9的索引,所以在这种情况下我会打印出索引2,4,6和8处的数字.这是我到目前为止所写的但是它不起作用.请注意,我不打算打印出数组的偶数.我想要的只是偶数索引.

示例我输入以下数组: 3,7,5,5,5,7,7,9,9,3

节目输出:

5 // (the number at index 2)
5 // (the number at index 4)
7 // (the number at index 6)
9 // (the number at index 8)
Run Code Online (Sandbox Code Playgroud)

我的代码:

public class Arrayevenindex 
{
    public static void main(String[] args)
    {
        int number; // variable that will represent how many elements the user wants the array to have

        Scanner key = new Scanner(System.in);

        System.out.println(" How many elements would you like your array to have");
        number = key.nextInt();
        int …
Run Code Online (Sandbox Code Playgroud)

java arrays

1
推荐指数
1
解决办法
7739
查看次数

XMPPFramework - 如何将图像从一台设备传输到另一台设备?

我已经使用 XMPP 协议进行了一对一聊天。现在,我想在我的应用程序中发送图像和视频。我研究了文件传输,但没有找到解决方案。我还使用了下面的代码进行 Socket 连接。

请建议我如何去做这件事。

[TURNSocket setProxyCandidates:@[@"MyserverHost-desktop"]];

XMPPJID *jid = [XMPPJID jidWithString:@"1254225445@MyserverHost-desktop"];

TURNSocket *turnSocket = [[TURNSocket alloc] initWithStream:[[self appDelegate]xmppStream] toJID:jid];

[app.turnSocketArray addObject:turnSocket];
[turnSocket startWithDelegate:self delegateQueue:dispatch_get_main_queue()];
[turnSocket release];

- (void)turnSocket:(TURNSocket *)sender didSucceed:(GCDAsyncSocket *)socket
{
}

- (void)turnSocketDidFail:(TURNSocket *)sender
{
}
Run Code Online (Sandbox Code Playgroud)

每次连接失败方法调用..

谢谢。

xmpp objective-c ios xmppframework

0
推荐指数
1
解决办法
3341
查看次数

标签 统计

ios ×3

objective-c ×3

xmpp ×3

xmppframework ×3

arrays ×1

java ×1