作者热门文章
- c - 在位数组中找到第一个零
- linux - Unix 显示有关匹配两种模式之一的文件的信息
- 正则表达式替换多个文件
- linux - 隐藏来自 xtrace 的命令
我有以下代码(在下面给出),我在其中使用 NSURLConnection
来连接和解析响应字符串。但是我收到以下错误:
dyld: Symbol not found: _CFXMLNodeGetInfoPtr
Referenced from: /System/Library/Frameworks/Security.framework/Versions/A/Security
Expected in: /Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator4.3.sdk/System/Library/Frameworks/CoreFoundation.framework/CoreFoundation
in /System/Library/Frameworks/Security.framework/Versions/A/Security
我已经为此工作了很长时间,但未能修复此错误。
我已经导入了 json.h 和 ASIHTTPRequest.h,所有这些文件,仍然没有修复错误。
@implementation Websample1ViewController
- (void)viewDidLoad
{
[super viewDidLoad];
dataWebService = [[NSMutableData data] retain];
NSMutableURLRequest *request = [[NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"https://www.googleapis.com/customsearch/v1?key=AIzaSyDzl0Ozijg2C47iYfKgBWWkAbZE_wCJ-2U&cx=017576662512468239146:omuauf_lfve&q=lectures&callback=handleResponse"]]retain];
NSURLConnection *myConnection = [NSURLConnection connectionWithRequest:request delegate:self];
[myConnection start];
}
- (void)connection:(NSURLConnection *)connection didReceiveResponse:(NSURLResponse *)response
{
[dataWebService setLength:0];
}
- (void)connection:(NSURLConnection *)connection didReceiveData:(NSData *)data
{
[dataWebService appendData:data];
}
- (void)connectionDidFinishLoading:(NSURLConnection *)connection
{
NSString *responseString = [[NSString alloc] initWithData:dataWebService encoding:NSUTF8StringEncoding];
NSLog(@"Response: %@",responseString);
[responseString release];
[dataWebService release];
}
- (void)connection:(NSURLConnection *)connection didFailWithError:(NSError *)error
{
NSLog(@"Error during connection: %@", [error description]);
}
//class 2
@implementation WebJson
//parse JSON
- (void)requestCompleted:(ASIHTTPRequest *)request
{
NSString *responseString = [request responseString];
NSDictionary *dictionary = [responseString JSONValue];
NSDictionary *dictionaryReturn = (NSDictionary*) [dictionary objectForKey:@"request"];
NSString *total = (NSString*) [dictionaryReturn objectForKey:@"totalResults"];
NSLog(@"totalResults: %@", total);
NSString *search = (NSString*) [dictionaryReturn objectForKey:@"searchTerms"];
NSLog(@"searchTerms: %@", search);
int count = [[dictionaryReturn objectForKey:@"count"] intValue];
NSLog(@"count: %d", count);
}
最佳答案
dyld错误是由库链接(而不是代码)丢失或错误引起的。
仔细检查您的框架链接,不要犹豫删除/重新创建链接,注意您从中获取框架的 iOS 版本。 (通常使用 Xcode 提供的列表,不要浏览文件)
在您的情况下,我不会对链接 /System/Library/Frameworks/Security.framework
感到惊讶是一个错误,因为它看起来不属于 iOS SDK,查看它的路径...
我猜应该是:/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator<Version>.sdk/System/Library/Frameworks/Security.framework
关于iphone - 迪尔德 : Symbol not found: error how to resolve this issue,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/6344560/
我是操作系统新手,我正在尝试执行下面提到的以下命令,但无法解决它不起作用的原因。 我正在尝试执行命令 ls -l | grep D|grep De 这是我的代码 - #include #include
我是一名优秀的程序员,十分优秀!