Xcode6/Swift: Unrecognized Selector Sent to Instance

XCode6/Swift: unrecognized selector sent to instance

As indicated in the first line of your dump, you're trying to send ...numberOfRows... to an object of class UIViewController but that method is only implemented in your subclass.

In your nib file you need to change the class of your view controller from UIViewController (the default) to ViewController.

Open your storyboard (or nib file) select the controller itself (it has an icon at the bottom (or top in Xcode 6) that will say "View Controller" when you mouse over it.

Sample Image

Then select the 3rd icon from the properties panel and up at the top where it says "Custom Class" enter "ViewController"

Sample Image

iOS - Using custom framework causing 'unrecognized selector sent to instance' in simulator only

Thinks you are building the framework without simulator architecture, you should choose simulator when build the framework, and navigate to Release/iphonesimulator and use that framework if you want to test your framework in simulator, the file in release/iphoneos is only for use in device target.

Create aggregate target with run script can help create fat framework (include both device and simulator archs) but app with this framework wont make it to AppStore. Sample script can be found in here.

To create framework for simulator, compile the framework while targeting any simulator in device target.

Swift app crashes with `unrecognized selector sent to instance` on CLLocationManager

This code won't run on iOS 7 and below - according the docs, requestWhenInUseAuthorization is only available on iOS 8:

Availability:

Available in iOS 8.0 and later.

[NSSearchField object]: unrecognized selector sent to instance

Solved by defining a custom method

@IBAction func controlTextDidChange_Custom(obj: NSSearchField!) {
if (!obj.stringValue.isEmpty) {
println("Searched: \(obj.stringValue)")
} else {
println("EMPTY")
}
}

-[__NSArrayI objectForKeyedSubscript:]: unrecognized selector sent to instance IN xcode6 objective-c ios

I can only tell you what's happening in your code, not where it's happening, as you've not posted the offending code.

The objectForKeyedSubscript method is called for NSDictionary subscripting, for example:

NSDictionary *dict = @{ @"key" : @"value" };
NSString *value = dict[@"key"]; // HERE

so it looks like you are doing something like this:

for(int i=0; i < 3; i++){
[_myMutableArray addObjects: [NSNumber numberWithInt: i]
}
NSNumber *num = _myMutableArray[@"3"]; // !!!!

One more thing I can tell you, it's not to do with uninitialized array as Objective-C simply ignores attempts to dereference nil objects and this exception has gone further than that.

Sometimes EXC_BAD_ACCESS and sometimes unrecognized selector sent to instance

I found out where was my problem. I read some of the Apple memory management and read about NSZombie which make me know that the NSObject is removed from the memory because of multiple reasons and that are:

1) I didn't declare it in the beginning of the calling class that is MainViewController so when it complete all the initiating procedures, it closes and removed from the memory and so GotoLinkURL function does not exist.

2) Then I declared in the MainViewController but I figured out that the last object only is exist in the memory because I was calling it in for loop statements so I Held all the NSObjects in an array and that did the trick.

Unrecognized Selector isSpringLoaded Sent to NSButton in Xib in XCode 6.3

Xcode quit unexpectedly in interface builder

Upgrade to the latest OS X (currently 10.10.3 as of posting)

Apparently, Xcode IB engineers don't believe in using respondsToSelector: in their versioned API



Related Topics



Leave a reply



Submit