I have the following code (given below) where I am using NSURLConnection
for connecting and parsing the response string. But I am getting the following error:
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
I have been working on this for a long itme without being able to fix this error.
I have imported json.h and ASIHTTPRequest.h, all those files, still, it has not fixed the error.
@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);
}
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…