IPhone開發環境搭建教程

來源:互聯網
上載者:User

IPhone開發環境搭建是本文要介紹的內容,主要介紹的是平衡環境搭建,很詳細的為友們介紹了iphone開發,先來看詳細內容。

一、 確定Mac OS的版本號碼

版本號碼:Mac OS X version 10.5.5

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

說明:每個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 項目,就算建好也編譯不過。出現如下錯誤:

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

所以需要進一步設定檔

4. 配置Architectures.xcspec檔案

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

進入到 

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

你會看到3個檔案,修改其中的Architectures.xcspec檔案

注意:不要用copy內頁代碼來改,要用手動輸入,因為網頁編碼不一致問題。

具體修改如下:

 
  1. (  
  2. // 32-Bit  
  3. { Type = Architecture;  
  4. Identifier = Standard;  
  5. Name = "Standard (iPhone Simulator: i386, ppc)";  
  6. Description = "32-bit iPhone Simulator architectures";  
  7. ListInEnum = YES;  
  8. SortNumber = 1;  
  9. RealArchitectures = ( i386, ppc );  
  10. ArchitectureSetting = "ARCHS_STANDARD_32_BIT";  
  11. },  
  12. // Old-style Debug  
  13. { Type = Architecture;  
  14. Identifier = Native;  
  15. Name = "Native Architecture of Build Machine";  
  16. Description = "32-bit for build machine";  
  17. ListInEnum = YES;  
  18. SortNumber = 101;  
  19. ArchitectureSetting = "NATIVE_ARCH";  
  20. },  
  21. // G3  
  22. { Type = Architecture;  
  23. Identifier = ppc;  
  24. Name = "Minimal (32-bit PowerPC only)";  
  25. Description = "32-bit PowerPC ";  
  26. PerArchBuildSettingName = "PowerPC";  
  27. ByteOrder = big;  
  28. ListInEnum = No;  
  29. SortNumber = 201;  
  30. },  
  31. // G4  這個是我台機的型號  
  32.  
  33. { Type = Architecture;  
  34. Identifier = ppc7400;  
  35. Name = "PowerPC G4";  
  36. Description = "32-bit PowerPC for G4 processor";  
  37. ByteOrder = big;  
  38. ListInEnum = NO;  
  39. SortNumber = 202;  
  40. },  
  41. // G5 32-bit  
  42. { Type = Architecture;  
  43. Identifier = ppc970;  
  44. Name = "PowerPC G5 32-bit";  
  45. Description = "32-bit PowerPC for G5 processor";  
  46. ByteOrder = big;  
  47. ListInEnum = NO;  
  48. SortNumber = 203;  
  49. },  
  50. // Intel  
  51. { Type = Architecture;  
  52. Identifier = i386;  
  53. Name = "Intel";  
  54. Description = "32-bit Intel";  
  55. PerArchBuildSettingName = "Intel";  
  56. ByteOrder = little;  
  57. ListInEnum = NO;  
  58. SortNumber = 105;  
  59. },  

注意:不要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開啟屬性視窗修改控制項屬性。

然後

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

小結:IPhone開發環境搭建教程的內容介紹完了,希望本文對你有所協助!

相關文章

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.