Monthly Archives: August 2016

-QQAPI- QQApi.m:428 param error: nil object

0、先说现象:找开App在使用QQ分享时提示“参数错误”,第一次分享时都会这样,重复操作一切正常!

1、正常情况下项目中使用QQ分享功能,只需要创建分享对象,然后调用接口分享即可,官方代码示例:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
NSString *utf8String = @"http://www.163.com";
NSString *title = @"新闻标题";
NSString *description = @"新闻描述";
NSString *previewImageUrl = @"http://cdni.wired.co.uk/620x413/k_n/NewsForecast%20copy_620x413.jpg";
QQApiNewsObject *newsObj = [QQApiNewsObject
                            objectWithURL:[NSURL URLWithString:utf8String]
                            title:title
                            description:description
                            previewImageURL:[NSURL URLWithString:previewImageUrl]];
SendMessageToQQReq *req = [SendMessageToQQReq reqWithContent:newsObj];
//将内容分享到qq
//QQApiSendResultCode sent = [QQApiInterface sendReq:req];
//将内容分享到qzone
QQApiSendResultCode sent = [QQApiInterface SendReqToQZone:req];