[XMPP]iOS聊天软件学习笔记[一]
@import url(http://i.cnblogs.com/Load.ashx?type=style&file=SyntaxHighlighter.css);@import url(/css/cuteeditor.css);
@import url(http://i.cnblogs.com/Load.ashx?type=style&file=SyntaxHighlighter.css);@import url(/css/cuteeditor.css);
通过前面的学习后,准备开始正式自己写一个项目
开发时间:五天(工作时间)
开发工具:xcode6
开发平台:iOS8
XMPP框架:XMPPFramework
git clone https://github.com/robbiehanson/XMPPFramework.git
界面设计:使用StoryBoard
github地址:https://github.com/hjandyz/XMPP
第一天基本完成了“其他登陆”界面,这里只将注意点做笔记
1.枚举和block的定义并用于回调
typedef enum {
XMPPResultTypeLoginSuccess,
XMPPResultTypeLoginFailure,
XMPPResultTypeNetErr
}XMPPResultType;
typedef void (^XMPPRresultBlock)(XMPPResultType type);
if (error && _resultBlock) {
_resultBlock(XMPPResultTypeNetErr);
}
if (_resultBlock) {
_resultBlock(XMPPResultTypeLoginSuccess);
}
2.block内要把self设置成弱指针
__weak typeof (self) weekSelf = self;
[delegate xmppUserLogin:^(XMPPResultType type) {
[weekSelf handleResultTye:type];
}];
3.切换rootViewComtroller时记得dismiss模态窗口,不然会造成内存泄漏
//隐藏模态窗口
[self dismissViewControllerAnimated:YES completion:nil];
4.建立新连接前如果已经建立过连接要断开
//如果以前连接过要断开
[_XMPPStream disconnect];
//连接主机
[self connentToHost];
5.MBProgressHUD如果view为nil会显示到window上面去
[MBProgressHUD showHUDAddedTo:view animated:YES]
6.自定义Log的方法
//自定义log
#ifdef DEBUG
#define HJLog(...) NSLog(@"%s %@",__func__,[NSString stringWithFormat:__VA_ARGS__])
#else
#define HJLog(...)
#endif
[XMPP]iOS聊天软件学习笔记[一]的更多相关文章
- [XMPP]iOS聊天软件学习笔记[四]
昨天完成了聊天界面,基本功能算告一段落 开发时间:五天(工作时间) 开发工具:xcode6 开发平台:iOS8 XMPP框架:XMPPFramework git clone https://githu ...
- [XMPP]iOS聊天软件学习笔记[三]
今天做了好友界面,其实xmpp内部已经写好很多扩展模块,所以使用起来还是很方便的 开发时间:五天(工作时间) 开发工具:xcode6 开发平台:iOS8 XMPP框架:XMPPFramework gi ...
- [XMPP]iOS聊天软件学习笔记[二]
@import url(http://i.cnblogs.com/Load.ashx?type=style&file=SyntaxHighlighter.css);@import url(/c ...
- cocos2d-x 3.1.1学习笔记[23]寻找主循环 mainloop
文章出自于 http://blog.csdn.net/zhouyunxuan cocos2d到底是怎样把场景展示给我们的,我一直非常好奇. 凭个人猜想,引擎内部的结构类似于这样 while(true ...
- cocos2d-x 3.1.1 学习笔记[21]cocos2d-x 创建过程
文章出自于 http://blog.csdn.net/zhouyunxuan RootViewController.h #import <UIKit/UIKit.h> @interfac ...
- cocos2d-x 3.1.1 学习笔记[3]Action 动作
这些动画貌似都非常多的样子,就所有都创建一次. 代码例如以下: /* 动画*/ auto sp = Sprite::create("card_bg_big_26.jpg"); Si ...
- cocos2d-x 3.1.1 学习笔记[2]Sprite 精灵
Sprite应该是用到最多的一个类吧.无法想像一个游戏没有精灵将怎样进行愉快的玩耍. Sprite继承于Node 和 TextureProtocol. Sprite是一个2d的图像. Sprite能够 ...
- cocos2d-x 3.1.1 学习笔记[17] 关于这些活动功能
供cocos2d-x通常使用的方法,我有一个好脸色.这项研究真的奖励. 向导首先,定义,实施一系列连续动作. 对于我们的行动能回调函数,我们必须申报并加以实施. void callBack(); vo ...
- cocos2d-x 3.1.1 学习笔记[4]GridActions 网格动画
文章写的 http://blog.csdn.net/zhouyunxuan 老样子.见代码. //GridActions can only used on NodeGrid auto nodeGri ...
随机推荐
- Android-3 Activity启动模式
Activity启动模式 android:launchMode="singleTask" * Standard 每次都创建一个新实例 -- TaskID不变,ActivityID改 ...
- 深度学习word2vec笔记之应用篇
好不容易学了一个深度学习的算法,大家是否比较爽了?但是回头想想,学这个是为了什么?吹牛皮吗?写论文吗?参加竞赛拿奖吗? 不管哪个原因,都显得有点校园思维了. 站在企业的层面,这样的方式显然是不符合要求 ...
- Discuz!提取文章标签
<?php //强制使用字符集 @header('Content-Type: text/html; charset=gbk'); $subjectenc ='title'; //这是 ...
- 'ascii' codec can't decode byte 0xef in position 0: ordinal not in range(128)——引用
在Django视图函数中经常出现类似于'ascii' codec can't decode byte 0xef in position 0: ordinal not in range(128)的错误. ...
- 使用StreamReader与StreamWriter进行文本文件读写
namespace filetest { class FileUtil { public static void WriteFile(string file) { using (FileStream ...
- Ext4.0.7使用Ext.grid.ColumnModel报错:TypeError: Ext.grid.Model is not a constructor
代码如下: Ext.onReady(function(){ //定义列 var cm = new Ext.grid.ColumnModel([ {header: '编号', dataIndex: 'i ...
- 关appid
https://code.google.com/p/goagent/wiki/InstallGuide 申请appid
- poj2505-A multplication game
题意:两个人轮流用2~9来乘n,使n不断扩大,n开始为1.当给一个固定值k,谁先使n超过k谁赢. 分析:能到达必败态的状态为必胜态,只能到达必胜态的状态为必败态.对于给定的k,n>=k时为必败态 ...
- 转:sql语句中GROUP BY 和 HAVING和使用 count()
在开发时,我们经常会遇到以“累计(count)”或是“累加(sum)”为条件的查询.比如user_num表: id user num 1 a 3 2 a 4 3 b 5 4 b 7 例1:查询出现 ...
- [置顶] Android学习系列-Android中解析xml(7)
Android学习系列-Android中解析xml(7) 一,概述 1,一个是DOM,它是生成一个树,有了树以后你搜索.查找都可以做. 2,另一种是基于流的,就是解析器从头到尾解析一遍xml文件. ...