---
title: "ios使用预编译命令解决问题"
author: "zcw_java"
date: "2013-08-12T13:44:10Z"
tags: []
categories: ["移动开发"]
slug: "ios"
draft: false
lastmod: "2013-08-12T13:44:10Z"
id: 1923421
url: "https://zcw-java.iteye.com/blog/1923421"
---

对于MacOS设备不同，做出相应响应

```c++

#if TARGET_OS_IPHONE
//iPhone真机
#elif TARGET_OS_MAC
//Mac下
#elif TARGET_IPHONE_SIMULATOR
//iPhone模拟器
#endif
//结束

```


pch是对整个项目的预编译

```c++

#ifdef __OBJC__
    #import <UIKit/UIKit.h>
    #import <Foundation/Foundation.h>
    #import "AppDelegate.h"
#endif

```