ios - EXC_BAD_ACCESS on NSClassFromString when class doesn't exist -
nsclassfromstring supposed return nil when can't find class, i'm getting exc_bad_access crash on this:
classname = "foo" var fooclass = nsclassfromstring(classname)
how can safely check non-existence of class in swift & objective-c?
this code working under swift:
var classname = "foo" var fooclass = nsclassfromstring(classname)
and 1 objective-c:
nsstring* classname = @"foo"; id fooclass = nsclassfromstring(classname);
your code seems correct
did try upgrade xcode in order have latest version of swift?