FHSTwitterEngine-'NSInvalidArgumentException','数据参数为nil' [英] FHSTwitterEngine - 'NSInvalidArgumentException','data parameter is nil'
问题描述
我正在使用FHSTwitterEngine将gif发布到twitpic.当我在iPhone上具有wifi或3G连接时,一切正常.但是我也想在没有连接或上传失败时实现一些错误处理.因此,为了进行测试,我将iPhone置于飞行模式,并尝试使用以下方法上传到twitpic:
I'm using FHSTwitterEngine to post a gif to twitpic. When I have a wifi or 3G connection on the iphone everything works fine. But I also want to implement some error handling for when there is no connection or when the upload failed. So for testing I put the iphone in airplane mode and try to upload to twitpic using the following method:
id returned = [[FHSTwitterEngine sharedEngine] uploadImageToTwitPic:gif
withMessage:@"message" twitPicAPIKey:@"key"];
但是当我这样做时,我立即收到以下错误:
but when I do that I immediately get the following error:
Terminating app due to uncaught exception 'NSInvalidArgumentException',
reason: 'data parameter is nil'
然后xcode指向FHSTwitterEngine框架中的这一行代码:
then xcode points to this line of code in the FHSTwitterEngine framework:
id parsedJSONResponse = removeNull([NSJSONSerialization JSONObjectWithData:responseData
options:NSJSONReadingMutableContainers error:nil]);
有关如何解决此问题的任何想法?
any ideas on how to solve this?
推荐答案
您可以先检查Internet连接.
You could check for internet connectivity first.
Reachability *networkReachability = [Reachability reachabilityForInternetConnection];
NetworkStatus networkStatus = [networkReachability currentReachabilityStatus];
if (networkStatus == NotReachable) {
NSLog(@"There IS NO internet connection");
} else {
NSLog(@"There IS internet connection");
}
}
这篇关于FHSTwitterEngine-'NSInvalidArgumentException','数据参数为nil'的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!