Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Error when compiling for device but not simulator

Tags:

xcode

iphone

I get the following error when compiling my project for the device, but not the simulator: error: objc/objc-class.h: No such file or directory

One of the files i have imports objc/objc-class.h and this is where it chokes.

Base SDK is iPhone OS 4.0 and deployment target is OS 3.2

Thanks

like image 684
Nick Avatar asked Aug 31 '10 02:08

Nick


People also ask

Can I run an iOS app on a simulator?

After you create a project, you can build and run your app on a simulated or real device without needing to lay out the user interface or write code. You may connect a real device to your Mac using a cable, or for iOS or tvOS apps, connect it over Wi-Fi after you pair it with Xcode.

What is Xcodebuild?

DESCRIPTION. xcodebuild builds one or more targets contained in an Xcode project, or builds a scheme contained in an Xcode workspace or Xcode project. Usage To build an Xcode project, run xcodebuild from the directory containing your project (i.e. the directory containing the projectname.

What is build active architecture only?

The "build active architecture only" setting causes everything except the current Mac's architecture to be ignored (and the current one is of course valid), hiding the problem. Instead, you should look up a row or two in the settings, and change the "Architectures" setting to "Standard".


2 Answers

Try

#import <objc/runtime.h>

instead of

#import <objc/objc-class.h>

This worked for me, both for simulator & device.

like image 56
Yan Avatar answered Sep 28 '22 05:09

Yan


On iOS it's

#import <objc/runtime.h>

like image 29
Doug Avatar answered Sep 28 '22 04:09

Doug