I am trying to make a Wolfram | Alpha searcher in XCode 5. Using the API I need to access the pods (the first level of NSCollectionView
) and the subpods (The nested NSCollectionView
). I have a pod class (properties: podTitle
[NSString
] and subpods [NSMutableArray
of Subpods]) and a subpod class (properties: subPodTitle [NSString
] and image [NSImage
]). I have two NSArrayControllers
, one linked to the viewcontroller's array of pods, and one to each to the represented object's subpods.
Sample output: http://products.wolframalpha.com/api/explorer.html When I perform a query I get the following error:
[_NSClipViewOverhangView delegate]: unrecognized selector sent to instance 0x600000122c60'
on the following line [podArrayController rearrangeObjects]
- (IBAction)waSearch:(NSSearchField *)sender {
[self.wa.pods removeAllObjects];
self.wa.input = [sender stringValue];
self.wa.url = [NSString stringWithFormat:@"http://api.wolframalpha.com/v2/query?appid=%@&input=%@&format=html,image,plaintext,sound", appID, self.wa.input];
NSLog(@"%@", self.wa.input);
dispatch_queue_t fetchQueue = dispatch_queue_create("fetch xml", NULL);
dispatch_async(fetchQueue, ^{[self.wa performQuerywithURL:self.wa.url];
dispatch_async(dispatch_get_main_queue(), ^{
[podArrayControler rearrangeObjects];
[subpodArrayControler rearrangeObjects];
});
});
}
Method used to add pods
- (NSMutableArray *)performQuerywithURL:(NSString *)url {
url = [url stringByAddingPercentEscapesUsingEncoding:NSASCIIStringEncoding];
NSXMLDocument *xml = [[NSXMLDocument alloc] initWithContentsOfURL:[NSURL URLWithString:url] options:(NSXMLNodePreserveWhitespace|NSXMLNodePreserveCDATA) error:nil];
//NSArray *img_xmlnodes = [xml nodesForXPath:@".//subpod/img" error:nil];
NSArray *pod_xmlnodes = [xml nodesForXPath:@".//pod" error:nil];
for (NSXMLNode *waPod in pod_xmlnodes) {
if ([waPod kind] == NSXMLElementKind) {
Pod* pod = [[Pod alloc] init];
for (NSXMLNode* podAttribute in [((NSXMLElement *) waPod) attributes]) {
if ([[podAttribute name] isEqualToString:@"title"]) {
pod.podTitle = [podAttribute stringValue];
}
}
NSArray* pod_children = [waPod nodesForXPath:@".//subpod" error:nil];
for (NSXMLNode *child in pod_children) {
if ([child kind] == NSXMLElementKind) {
Subpod *subPod = [[Subpod alloc] init];
subPod.subPodTitle = [[((NSXMLElement *) child) attributes][0] stringValue];
NSLog(@"%@%@", subPod.subPodTitle, [[([((NSXMLElement *) child) children][1]) attributes][0] stringValue]);
subPod.image = [[NSImage alloc] initWithContentsOfURL:[NSURL URLWithString:[[([((NSXMLElement *) child) children][1]) attributes][0] stringValue]]];
[pod.subpods addObject:subPod];
}
}
[self.pods addObject:pod];
}
}
return self.pods;
}
Full error:
-[_NSClipViewOverhangView delegate]: unrecognized selector sent to instance 0x600000124060
objc[10578]: EXCEPTIONS: throwing 0x600000127058 (object 0x60000024c3f0, a NSException)
objc[10578]: EXCEPTIONS: searching through frame [ip=0x7fff8ce5570e sp=0x7fff5fbfdcf0] for exception 0x600000127038
objc[10578]: EXCEPTIONS: catch(NSException)
objc[10578]: EXCEPTIONS: unwinding through frame [ip=0x7fff8ce5570e sp=0x7fff5fbfdcf0] for exception 0x600000127038
objc[10578]: EXCEPTIONS: handling exception 0x600000127038 at 0x7fff8ce5572d
objc[10578]: EXCEPTIONS: throwing 0x600000126fb8 (object 0x60000024c3f0, a NSException)
objc[10578]: EXCEPTIONS: searching through frame [ip=0x7fff8ce55741 sp=0x7fff5fbfdcf0] for exception 0x600000126f98
objc[10578]: EXCEPTIONS: searching through frame [ip=0x7fff8d3f02ac sp=0x7fff5fbfdff0] for exception 0x600000126f98
objc[10578]: EXCEPTIONS: unwinding through frame [ip=0x7fff8ce55741 sp=0x7fff5fbfdcf0] for exception 0x600000126f98
objc[10578]: EXCEPTIONS: finishing handler
objc[10578]: EXCEPTIONS: releasing completed exception 0x600000127058 (object 0x60000024c3f0, a NSException)
objc[10578]: EXCEPTIONS: unwinding through frame [ip=0x7fff8ce5575e sp=0x7fff5fbfdcf0] for exception 0x600000126f98
objc[10578]: EXCEPTIONS: unwinding through frame [ip=0x7fff8d3f02ac sp=0x7fff5fbfdff0] for exception 0x600000126f98
objc[10578]: EXCEPTIONS: handling exception 0x600000126f98 at 0x7fff8d3f02bc
objc[10578]: EXCEPTIONS: terminating
objc[10578]: EXCEPTIONS: searching through frame [ip=0x7fff94a812d4 sp=0x7fff5fbfdf90] for exception 0x600000126f98
objc[10578]: EXCEPTIONS: catch(id)
objc[10578]: EXCEPTIONS: unwinding through frame [ip=0x7fff94a812d4 sp=0x7fff5fbfdf90] for exception 0x600000126f98
objc[10578]: EXCEPTIONS: handling exception 0x600000126f98 at 0x7fff94a812f3
2013-11-20 16:51:24.000 AAU[10578:303] An uncaught exception was raised
2013-11-20 16:51:24.010 AAU[10578:303] -[_NSClipViewOverhangView delegate]: unrecognized selector sent to instance 0x600000124060
2013-11-20 16:51:24.010 AAU[10578:303] (
0 CoreFoundation 0x00007fff8c00141c __exceptionPreprocess + 172
1 libobjc.A.dylib 0x00007fff94a80e75 objc_exception_throw + 43
2 CoreFoundation 0x00007fff8c0042ed -[NSObject(NSObject) doesNotRecognizeSelector:] + 205
3 CoreFoundation 0x00007fff8bf5f5b2 ___forwarding___ + 1010
4 CoreFoundation 0x00007fff8bf5f138 _CF_forwarding_prep_0 + 120
5 AppKit 0x00007fff8ce77e56 -[NSCollectionViewItem _copyConnectionsOfObject:prototypeItem:toObject:item:] + 313
6 AppKit 0x00007fff8ce78058 -[NSCollectionViewItem _copyConnectionsOfObject:prototypeItem:toObject:item:] + 827
7 AppKit 0x00007fff8ce78058 -[NSCollectionViewItem _copyConnectionsOfObject:prototypeItem:toObject:item:] + 827
8 AppKit 0x00007fff8ce78058 -[NSCollectionViewItem _copyConnectionsOfObject:prototypeItem:toObject:item:] + 827
9 AppKit 0x00007fff8ce780d2 -[NSCollectionViewItem _copyConnectionsToItem:] + 95
10 AppKit 0x00007fff8ce77cce -[NSCollectionViewItem copyWithZone:] + 516
11 AppKit 0x00007fff8ce79cde -[NSCollectionView newItemForRepresentedObject:] + 68
12 AppKit 0x00007fff8ce80c01 -[NSCollectionView _getItemsToDisplay] + 1198
13 AppKit 0x00007fff8ce793ca -[NSCollectionView setContent:] + 214
14 AppKit 0x00007fff8ce5570f -[NSCollectionViewBinder _updateContent] + 91
15 AppKit 0x00007fff8ce557b3 -[NSCollectionViewBinder _observeValueForKeyPath:ofObject:context:] + 84
16 Foundation 0x00007fff91238c18 NSKeyValueNotifyObserver + 387
17 Foundation 0x00007fff91275e71 -[NSObject(NSKeyValueObservingPrivate) _notifyObserversForKeyPath:change:] + 1115
18 AppKit 0x00007fff8c6c5c48 -[NSController _notifyObserversForKeyPath:change:] + 209
19 AppKit 0x00007fff8c7f76a7 -[NSArrayController didChangeValuesForArrangedKeys:objectKeys:indexKeys:] + 53
20 AAU 0x0000000100005395 __40-[AOUControllerViewController waSearch:]_block_invoke_2 + 53
21 libdispatch.dylib 0x00007fff8d3f31d7 _dispatch_call_block_and_release + 12
22 libdispatch.dylib 0x00007fff8d3f02ad _dispatch_client_callout + 8
23 libdispatch.dylib 0x00007fff8d3f7f03 _dispatch_main_queue_callback_4CF + 333
24 CoreFoundation 0x00007fff8bf68839 __CFRUNLOOP_IS_SERVICING_THE_MAIN_DISPATCH_QUEUE__ + 9
25 CoreFoundation 0x00007fff8bf23b14 __CFRunLoopRun + 1636
26 CoreFoundation 0x00007fff8bf23275 CFRunLoopRunSpecific + 309
27 HIToolbox 0x00007fff92367f0d RunCurrentEventLoopInMode + 226
28 HIToolbox 0x00007fff92367cb7 ReceiveNextEventCommon + 479
29 HIToolbox 0x00007fff92367abc _BlockUntilNextEventMatchingListInModeWithFilter + 65
30 AppKit 0x00007fff8c63d28e _DPSNextEvent + 1434
31 AppKit 0x00007fff8c63c8db -[NSApplication nextEventMatchingMask:untilDate:inMode:dequeue:] + 122
32 AppKit 0x00007fff8c6309cc -[NSApplication run] + 553
33 AppKit 0x00007fff8c61b803 NSApplicationMain + 940
34 AAU 0x0000000100001372 main + 34
35 libdyld.dylib 0x00007fff95af75fd start + 1
)
2013-11-20 16:51:24.012 AAU[10578:303] *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[_NSClipViewOverhangView delegate]: unrecognized selector sent to instance 0x600000124060'
*** First throw call stack:
(
0 CoreFoundation 0x00007fff8c00141c __exceptionPreprocess + 172
1 libobjc.A.dylib 0x00007fff94a80e75 objc_exception_throw + 43
2 CoreFoundation 0x00007fff8c0042ed -[NSObject(NSObject) doesNotRecognizeSelector:] + 205
3 CoreFoundation 0x00007fff8bf5f5b2 ___forwarding___ + 1010
4 CoreFoundation 0x00007fff8bf5f138 _CF_forwarding_prep_0 + 120
5 AppKit 0x00007fff8ce77e56 -[NSCollectionViewItem _copyConnectionsOfObject:prototypeItem:toObject:item:] + 313
6 AppKit 0x00007fff8ce78058 -[NSCollectionViewItem _copyConnectionsOfObject:prototypeItem:toObject:item:] + 827
7 AppKit 0x00007fff8ce78058 -[NSCollectionViewItem _copyConnectionsOfObject:prototypeItem:toObject:item:] + 827
8 AppKit 0x00007fff8ce78058 -[NSCollectionViewItem _copyConnectionsOfObject:prototypeItem:toObject:item:] + 827
9 AppKit 0x00007fff8ce780d2 -[NSCollectionViewItem _copyConnectionsToItem:] + 95
10 AppKit 0x00007fff8ce77cce -[NSCollectionViewItem copyWithZone:] + 516
11 AppKit 0x00007fff8ce79cde -[NSCollectionView newItemForRepresentedObject:] + 68
12 AppKit 0x00007fff8ce80c01 -[NSCollectionView _getItemsToDisplay] + 1198
13 AppKit 0x00007fff8ce793ca -[NSCollectionView setContent:] + 214
14 AppKit 0x00007fff8ce5570f -[NSCollectionViewBinder _updateContent] + 91
15 AppKit 0x00007fff8ce557b3 -[NSCollectionViewBinder _observeValueForKeyPath:ofObject:context:] + 84
16 Foundation 0x00007fff91238c18 NSKeyValueNotifyObserver + 387
17 Foundation 0x00007fff91275e71 -[NSObject(NSKeyValueObservingPrivate) _notifyObserversForKeyPath:change:] + 1115
18 AppKit 0x00007fff8c6c5c48 -[NSController _notifyObserversForKeyPath:change:] + 209
19 AppKit 0x00007fff8c7f76a7 -[NSArrayController didChangeValuesForArrangedKeys:objectKeys:indexKeys:] + 53
20 AAU 0x0000000100005395 __40-[AOUControllerViewController waSearch:]_block_invoke_2 + 53
21 libdispatch.dylib 0x00007fff8d3f31d7 _dispatch_call_block_and_release + 12
22 libdispatch.dylib 0x00007fff8d3f02ad _dispatch_client_callout + 8
23 libdispatch.dylib 0x00007fff8d3f7f03 _dispatch_main_queue_callback_4CF + 333
24 CoreFoundation 0x00007fff8bf68839 __CFRUNLOOP_IS_SERVICING_THE_MAIN_DISPATCH_QUEUE__ + 9
25 CoreFoundation 0x00007fff8bf23b14 __CFRunLoopRun + 1636
26 CoreFoundation 0x00007fff8bf23275 CFRunLoopRunSpecific + 309
27 HIToolbox 0x00007fff92367f0d RunCurrentEventLoopInMode + 226
28 HIToolbox 0x00007fff92367cb7 ReceiveNextEventCommon + 479
29 HIToolbox 0x00007fff92367abc _BlockUntilNextEventMatchingListInModeWithFilter + 65
30 AppKit 0x00007fff8c63d28e _DPSNextEvent + 1434
31 AppKit 0x00007fff8c63c8db -[NSApplication nextEventMatchingMask:untilDate:inMode:dequeue:] + 122
32 AppKit 0x00007fff8c6309cc -[NSApplication run] + 553
33 AppKit 0x00007fff8c61b803 NSApplicationMain + 940
34 AAU 0x0000000100001372 main + 34
35 libdyld.dylib 0x00007fff95af75fd start + 1
)
libc++abi.dylib: terminating with uncaught exception of type NSException
Nothing I have done seems to helped get any closer to correcting the bug, let alone why and how it is happening