IPhone开发环境搭建教程

移动开发 iOS
IPhone开发环境搭建是本文要介绍的内容,主要介绍的是平衡环境的搭建,很详细的为友们介绍iphone开发,先来看详细内容。

IPhone开发环境搭建是本文要介绍的内容,主要介绍的是平衡环境搭建,很详细的为友们介绍了iphone开发,先来看详细内容。

一、 确定Mac OS的版本号

版本号:Mac OS X version 10.5.5

CPU: Processor 1 GHz PowerPC G4  
iPhone SDK:iPhone_sdk_for_iPhone_os_2.2.19m2621afinal.dmg 
  • 1.
  • 2.

说明:每个IPhone SDK可能兼容的Mac OS都不同,该SDK支持10.5.3以后的版本。还有,Intel 和 PowerPC 不同的CPU设置文件也不同,同一种CPU不同型号,设置也不同(注意PowerPC G3/G4/G5不同型号),详细请看下文。

重点的是:官方的iPhone SDK只支持Intel Mac with OSX 10.5.

二、安装IPhone SDK

1. iPhone sdk 的后缀名为.dmg,只要双击该文件,弹出一个对话框,点“skip”,这就看到里面有3个文件,分别是About iPhone SDK.pdf 、iphone sdk.mpkg 、 Packages.如下图:

2. 双击iPhone sdk.mpkg,按引导到Custom Install on”Macintosh HD”那步,如图:

这是会看到iPhone SDK不可选,不知道是什么问题,不用害怕,下面有解决方案,我们是把可选的都选了,让所有的包都安装到默认的路径下。

注意: Developer Tools Essentials那个包的安装路径(默认为/Developer),等下安装iPhone SDK 时需要安装到同一路径下。

其实这一步已经安装好了Xcode3.1 了。

3. 安装iPhone SDK.

进入到刚才的前面.mdg包里面的Packages文件夹,即***张图中的Packages文件夹,选择如下5个包逐个安装。各个包名均以iphone*开头。

注意:

要安装到和Developer Tools Essentials同一目录,即/Developer

如果已经安装到其他目录,可以不用重装。进入到安装目录,默认是/Platforms,然后复制 iPhone.platform 和iPhoneSimulator.platform 到 /Developer/Platform,注意不要把整个/Platforms复制。

现在还不能建立iphone 项目,就算建好也编译不过。出现如下错误:

No architectures to compile for (ONLY_ACTIVE_ARCH = YES, active arch = ppc, i386 VALID_ARCHS =) 
  • 1.

所以需要进一步配置文件

4. 配置Architectures.xcspec文件

因为官方的iPhone SDK只支持Intel Mac with OSX 10.5.。所以要更改所有intel的配置。

进入到 

/Developer/Platforms/iPhoneSimulator.platform/Developer/  
Library/Xcode/Specifications/ 
  • 1.
  • 2.

你会看到3个文件,修改其中的Architectures.xcspec文件

注意:不要用copy内页代码来改,要用手动输入,因为网页编码不一致问题。

具体修改如下:

(  
// 32-Bit  
Type = Architecture;  
Identifier = Standard;  
Name = "Standard (iPhone Simulator: i386, ppc)";  
Description = "32-bit iPhone Simulator architectures";  
ListInEnum = YES;  
SortNumber = 1;  
RealArchitectures = ( i386, ppc );  
ArchitectureSetting = "ARCHS_STANDARD_32_BIT";  
},  
// Old-style Debug  
Type = Architecture;  
Identifier = Native;  
Name = "Native Architecture of Build Machine";  
Description = "32-bit for build machine";  
ListInEnum = YES;  
SortNumber = 101;  
ArchitectureSetting = "NATIVE_ARCH";  
},  
// G3  
Type = Architecture;  
Identifier = ppc;  
Name = "Minimal (32-bit PowerPC only)";  
Description = "32-bit PowerPC ";  
PerArchBuildSettingName = "PowerPC";  
ByteOrder = big;  
ListInEnum = No;  
SortNumber = 201;  
},  
// G4  这个是我台机的型号  
 
Type = Architecture;  
Identifier = ppc7400;  
Name = "PowerPC G4";  
Description = "32-bit PowerPC for G4 processor";  
ByteOrder = big;  
ListInEnum = NO;  
SortNumber = 202;  
},  
// G5 32-bit  
Type = Architecture;  
Identifier = ppc970;  
Name = "PowerPC G5 32-bit";  
Description = "32-bit PowerPC for G5 processor";  
ByteOrder = big;  
ListInEnum = NO;  
SortNumber = 203;  
},  
// Intel  
Type = Architecture;  
Identifier = i386;  
Name = "Intel";  
Description = "32-bit Intel";  
PerArchBuildSettingName = "Intel";  
ByteOrder = little;  
ListInEnum = NO;  
SortNumber = 105;  
},  

  • 1.
  • 2.
  • 3.
  • 4.
  • 5.
  • 6.
  • 7.
  • 8.
  • 9.
  • 10.
  • 11.
  • 12.
  • 13.
  • 14.
  • 15.
  • 16.
  • 17.
  • 18.
  • 19.
  • 20.
  • 21.
  • 22.
  • 23.
  • 24.
  • 25.
  • 26.
  • 27.
  • 28.
  • 29.
  • 30.
  • 31.
  • 32.
  • 33.
  • 34.
  • 35.
  • 36.
  • 37.
  • 38.
  • 39.
  • 40.
  • 41.
  • 42.
  • 43.
  • 44.
  • 45.
  • 46.
  • 47.
  • 48.
  • 49.
  • 50.
  • 51.
  • 52.
  • 53.
  • 54.
  • 55.
  • 56.
  • 57.
  • 58.
  • 59.
  • 60.

注意:不要copy,只能手输入以上代码,否则出错!!

这样就完成设置了。

简单Interface Builder工程,实现Hello World.

双击 /Developer/Applications/Xcoide.app

记得要到下面隐藏的快捷方式栏去找刚启动的Xcode,然后File->new project.

选择 View-Based Application.

然后,命名工程。

展开Groups&Files 下的 Resources目录,选择双击MainWindow.xib,就会弹出xib主窗口和libery窗口,如果没有,可以通过Tools来调出窗口。Libery里有不同的控件,可以拖放到View窗口里,单击选中控件,选择Tools->inspetor打开属性窗口修改控件属性。

然后

File->Save,Build->build and run. 
  • 1.

小结:IPhone开发环境搭建教程的内容介绍完了,希望本文对你有所帮助!

责任编辑:zhaolei 来源: 博客园
相关推荐

2011-07-08 16:02:24

iphone

2011-08-16 10:01:02

2011-09-14 10:52:39

Android 2.2

2011-09-13 17:15:58

Eclipse And

2009-12-30 18:02:32

Silverlight

2011-08-29 11:32:44

UbuntuiPhone

2011-07-22 18:13:59

IOS IDE Xcode

2011-07-06 17:34:47

iPhone

2010-09-25 09:31:27

EclipseAndroid

2011-08-10 15:48:10

iPhone网络

2011-07-19 14:11:07

Windows iPhone SDK

2012-05-15 14:00:51

WP7开发环境

2011-08-30 18:01:20

2011-08-10 18:24:22

iPhone 图形 绘图

2011-07-08 14:58:16

iPhone Xcode iOS

2011-09-13 15:26:25

MTK环境搭建

2011-09-27 11:30:29

SSH 环境搭建

2011-12-22 14:36:36

PhoneGapWindows Pho环境搭建

2013-07-23 06:11:44

Android开发学习Android开发环境Java

2011-07-21 10:29:18

iPhone 开发
点赞
收藏

51CTO技术栈公众号