https://github.com/zhonggaorong/QQLoginDemo
QQApiTextObject 文本对象
QQApiURLObject URL对象类型
QQApiExtendObject 扩展数据类型
QQApiImageObject 图片对象
QQApiImageArrayForQZoneObject 图片数组对象 用于分享图片到空间,走写说说路径,是一个指定为图片类型的,当图片数组为空时,默认走文本写说说
QQApiVideoForQZoneObject 视频对象
QQApiWebImageObject 网络图片对象
QQApiFileObject 本地文件对象
QQApiAudioObject 音频URL对象
QQApiVideoObject 视频URL对象 :用于分享目标内容为视频的URL的对象
QQApiNewsObject 新闻URL对象
/**
分享 新闻URL对象 。
获取一个autorelease的<code>QQApiAudioObject</code>
@param url 音频内容的目标URL
@param title 分享内容的标题
@param description 分享内容的描述
@param previewURL 分享内容的预览图像URL
@note 如果url为空,调用<code>QQApi#sendMessage:</code>时将返回FALSE
*/
NSURL *url = [NSURL URLWithString:@"http://www.baidu.com"];
NSURL *preimageUrl = [NSURL URLWithString:@"http://www.sizzee.com/index.php/catalog/product/view/id/55730/s/10196171/?SID=au0lhpg54f11nenmrjvhsh0rq6?uk=Y3VzdG9tZXJfaWQ9Mjc0fHByb2R1Y3RfaWQ9NTU3MzA"];
QQApiNewsObject* img = [QQApiNewsObject objectWithURL:url title:@"测试分享" description:[NSString stringWithFormat:@"分享内容------新闻URL对象分享 ------test"] previewImageURL:preimageUrl];
//请求帮助类,分享的所有基础对象,都要封装成这种请求对象。
SendMessageToQQReq* req = [SendMessageToQQReq reqWithContent:img];
QQApiSendResultCode sent = [QQApiInterface sendReq:req];
//通过自定义的qqdelegate来通知本controller,是否成功分享
appdelegate.qqDelegate = self;
NSLog(@"QQApiSendResultCode %d",sent);
[self handleSendResult:sent];
/* QQApiSendResultCode 说明
EQQAPISENDSUCESS = 0, 操作成功
EQQAPIQQNOTINSTALLED = 1, 没有安装QQ
EQQAPIQQNOTSUPPORTAPI = 2,
EQQAPIMESSAGETYPEINVALID = 3, 参数错误
EQQAPIMESSAGECONTENTNULL = 4,
EQQAPIMESSAGECONTENTINVALID = 5,
EQQAPIAPPNOTREGISTED = 6, 应用未注册
EQQAPIAPPSHAREASYNC = 7,
EQQAPIQQNOTSUPPORTAPI_WITH_ERRORSHOW = 8,
EQQAPISENDFAILD = -1, 发送失败
//qzone分享不支持text类型分享
EQQAPIQZONENOTSUPPORTTEXT = 10000,
//qzone分享不支持image类型分享
EQQAPIQZONENOTSUPPORTIMAGE = 10001,
//当前QQ版本太低,需要更新至新版本才可以支持
EQQAPIVERSIONNEEDUPDATE = 10002,
*/
}
- (void)handleSendResult:(QQApiSendResultCode)sendResult
{
switch (sendResult)
{
case EQQAPIAPPNOTREGISTED:
{
UIAlertView *msgbox = [[UIAlertView alloc] initWithTitle:@"Error" message:@"App未注册" delegate:nil cancelButtonTitle:@"取消" otherButtonTitles:nil];
[msgbox show];
break;
}
case EQQAPIMESSAGECONTENTINVALID:
case EQQAPIMESSAGECONTENTNULL:
case EQQAPIMESSAGETYPEINVALID:
{
UIAlertView *msgbox = [[UIAlertView alloc] initWithTitle:@"Error" message:@"发送参数错误" delegate:nil cancelButtonTitle:@"取消" otherButtonTitles:nil];
[msgbox show];
break;
}
case EQQAPIQQNOTINSTALLED:
{
UIAlertView *msgbox = [[UIAlertView alloc] initWithTitle:@"Error" message:@"未安装手Q" delegate:nil cancelButtonTitle:@"取消" otherButtonTitles:nil];
[msgbox show];
break;
}
case EQQAPIQQNOTSUPPORTAPI:
{
UIAlertView *msgbox = [[UIAlertView alloc] initWithTitle:@"Error" message:@"API接口不支持" delegate:nil cancelButtonTitle:@"取消" otherButtonTitles:nil];
[msgbox show];
break;
}
case EQQAPISENDFAILD: