How to deal with `Use of undeclared identifier 'UIDevice'`
Asked Answered
N

2

16

I followed the MD file step by step. But there is still an error in the compilation. What can I do?

In the FaceppClient.m file :

if ([[[UIDevice currentDevice] systemVersion] compare: @"5.0" options: NSNumericSearch ] != NSOrderedAscending)
    _ios50orNewer = true;

Xcode outputs this error :

Use of undeclared identifier 'UIDevice'

I added #import "UIDevice.h" in the file, but Xcode outputs "UIDevice.h not found".

I added the UIKit framework to the Project, but I still have the compilation issue.

What can I do then?

Nereidanereids answered 19/2, 2016 at 14:18 Comment(0)
E
40

Try adding this line at the top of your .m file :

#import <UIKit/UIKit.h>

Adding the framework to the project is useful, but you also have to include the needed headers in your code.

Engrave answered 19/2, 2016 at 14:22 Comment(0)
G
11

And for Swift 5 users who got here, try

import UIKit
Greece answered 5/7, 2019 at 21:15 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.