我在我的应用程序中实现了Web服务.我的方式很典型.
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{
//Web Service xxx,yyy are not true data
NSString *urlString = @"http://xxx.byethost17.com/yyy";
NSURL *url = [NSURL URLWithString:urlString];
dispatch_async(kBackGroudQueue, ^{
NSData* data = [NSData dataWithContentsOfURL: url];
[self performSelectorOnMainThread:@selector(receiveLatest:) withObject:data waitUntilDone:YES];
});
return YES;
}
- (void)receiveLatest:(NSData *)responseData {
//parse out the json data
NSError* error;
NSDictionary* json = [NSJSONSerialization
JSONObjectWithData:responseData
options:kNilOptions
error:&error];
NSString *Draw_539 = [json objectForKey:@"Draw_539"];
....
Run Code Online (Sandbox Code Playgroud)
控制台错误消息:
*由于未捕获的异常'NSInvalidArgumentException'终止应用程序,原因:'data parameter is nil'
当我的iPhone连接到Internet时,该应用程序成功运行.但如果它断开连接到互联网,应用程序将崩溃NSDictionary* json = [NSJSONSerialization JSONObjectWithData:responseData options:kNilOptions error:&error];
你能告诉我如何处理这个错误?有NSError帮助吗?
我将Xcode更新为5.1,并且在我的iOS应用程序项目中出现了许多使用opencv框架2.4的错误.我的电脑是macbook air和OSX 10.9.2.
当我编译我的项目时,它在我使用Iphone Retina(3.5英寸,4英寸)模拟器时工作正常.但是当我使用Iphone Retina(4英寸64位)时,我在尝试构建和运行时收到以下消息:
ld: warning: ignoring file /Users/mike/Documents/opencv2.framework/opencv2, missing required architecture x86_64 in file /Users/mike/Documents/opencv2.framework/opencv2 (3 slices)
Undefined symbols for architecture x86_64:
"CvKNearest::CvKNearest(CvMat const*, CvMat const*, CvMat const*, bool, int)", referenced from:
-[HomeViewController ocrTicket:] in HomeViewController.o
"CvKNearest::~CvKNearest()", referenced from:
-[HomeViewController ocrTicket:] in HomeViewController.o
"cv::_InputArray::_InputArray(cv::Mat const&)", referenced from:
-[HomeViewController ocrTicket:] in HomeViewController.o
PreProcessImage(cv::Mat*, cv::Mat*, int, int) in HomeViewController.o
PreProcessImageNew(cv::Mat*, cv::Mat*, int, int) in HomeViewController.o
-[HomeViewController FromMat:ObtainRect:] in HomeViewController.o
...
ld: symbol(s) not found for architecture x86_64
Run Code Online (Sandbox Code Playgroud)