Akash Kava Akash Kava - 1 year ago 144
Objective-C Question

xcode 8 error class is unavailable use self instead

After upgrading to XCode 8, some third party library stopped compiling.

NSArray *validTypes = @[
[NSString class],
[NSNumber class],
[NSDictionary class],
[NSArray class],
[NSNull class]

I am getting an error

`class` is unavailable, use `self` instead

Answer Source

For those who occurred the same problem, I recommend the following method with replacing class to self across whole project.

First, click on search tab and choose find and replace with regex

enter image description here

Enter the values you see on the screenshot and click preview to double check yourself. You should see something similar:

enter image description here