沒有Mac設備,Object-c、X-Code偶爾會讓你抓狂,有的是進入新領域的一腔熱情!
【錯誤信息】
按照網上教程通過VMware搭建IOS開發環境,我分別下載了
[蘋果操作系統.-.雪豹.10.6].snowleopard_10a432_userdvd.dmg
Rebel EFI.iso
xcode_3.2.3_and_iphone_sdk_4__final.dmg
進入Mac OS安裝xcode時卻出現
iphone SDK requires Mac OS X 10.6.2
To install the iphone SDK you must quit the installer and upgrade to Mac OS 10.6.2
原因及解決辦法:
查看了下Mac OS版本我的版本是10.6,原來安裝xcode_3.2.3一定需要Mac OS X 10.6.2以上版本
IOS SDK對應Xcode版本
iPhone SDK 3.1.3 with XCode 3.2.1 for Snow Leopard (10.6.0)
http://developer.apple.com/ios/download.action?path=/iphone/iphone_sdk_3.1.3__final/iphone_sdk_3.1.3_with_xcode_3.2.1__snow_leopard__10m2003a.dmg
iPhone SDK 3.2 Final with Xcode 3.2.2 for Snow Leopard (10.6.0)
http://developer.apple.com/ios/download.action?path=/iphone/iphone_sdk_3.2__final/xcode_3.2.2_and_iphone_sdk_3.2_final.dmg
Xcode 3.2.3 and iPhone SDK 4 GM seed for Snow Leopard (10.6.2)
http://developer.apple.com/ios/download.action?path=/iphone/iphone_sdk_4_gm_seed/xcode_3.2.3_and_iphone_sdk_4_gm_seed.dmg
Xcode 3.2.3 and iPhone SDK 4 Final for Snow Leopard (10.6.2)
http://developer.apple.com/ios/download.action?path=/iphone/iphone_sdk_4__final/xcode_3.2.3_and_iphone_sdk_4__final.dmg
最後只能去下載Mac 10.6.2補丁解決
Mac OS X v10.6.2 Update (Combo)
【錯誤信息】
IOS 10.6.2安裝Xcode時,如果出現如下錯誤:
the installation failed
xcode the installation failed an unknown error occurred, the installer encountered an an error that caused installation to failed
安裝失敗安裝器遇到了一個錯誤,導致安裝失敗。請聯繫軟件製造商以獲得幫助。
原因及解決辦法:
xCode簽名過期,需要把IOS系統時間修改爲XCode發佈最近時間就OK了,我的mac os的系統改成2012-01-01就可以了
【錯誤信息】
iphone啓動時出現如下代碼:
panic(cpu 0 caller 0x9dc33f3b):"a freed zone element has been modifed:expected 0xdeadbeef but found 0xdeadbeef,bits chabged 0xad0000,at offset 9 of 40 in zone:kalloc.40"
debugger message:panic
OS version:Not set yet
Kernel version:Darwin Kernel Version 13.0.0:Web Oct 10 23:29:02 PDT 2012;root:xnu-2107.2.34~2/RELEASE_ARM_S5L8930XIBoot version:iBoot-1537.4.21
secure boot?:YES
Paniclog version:1
Kernel slide:0X00000000001DC00000
.......
.......
Debugger message:panic\
OS version:Not set yet
Kernel version:Darwin Kernel Version 13.0.0:Web Oct 10 23:29:02 PDT 2012;root:xnu-2107.2.34~2/RELEASE_ARM_S5L8930XIBoot version:iBoot-1537.4.21
secure boot?:YES
Paniclog version:1
Kernel slide:0X00000000001DC00000
......
......
原因
iphone在火車上充電的地方充電之後沖壞的,後面會經常無故重啓,最終強制啓動也沒有辦法開機
解決辦法:
碰到這種情況,機器還能啓動如果在1年保修期內的儘快去蘋果專賣門店去維修,如果機器不能啓動的話只能送到蘋果官方指定的售後維修點維修
【錯誤信息】
Couldn't load cocos2dx.xcodeproj because it
is already opened from another project or works or
workspace
原因及解決辦法:
必須同時把之前的兩個項目都關閉,然後再打開項目(.xcodeproj),才正常。
【錯誤信息】
clang: error: no such file or directory: '/Users/shuizhuyu-mac/Desktop/demo test/開源項目/SegmentFault移動應用/iOSSF-master/SegmentFault/Support/AFNetworking/AFNetworking/AFHTTPClient.m'
clang: error: no input files
Command /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang failed with exit code 1
原因及解決辦法:
【錯誤信息】
+ (void)login:(UMViewController *)vc withCallback:(NSString *)callback
{
[vc.navigator openURL:[[NSURL URLWithString:@"sf://login"] addParams:[NSDictionary dictionaryWithObjectsAndKeys:
@"登錄", @"title",
callback, @"callback",
nil]]];
}
上面代碼出現如下錯誤:
/Users/shuizhuyu-mac/Desktop/demo test/開源項目/SegmentFault移動應用/iOSSF-master/SegmentFault/Services/SFLoginService.m:72:9: Property 'navigator' not found on object of type 'UMViewController *'
原因及解決辦法:
xcode版本的問題
【錯誤信息】
//這個是新按鈕的響應函數
-(IBAction) buttonClicked:(id)sender {
UIAlertView *alert = [[UIAlertView alloc] initWithTitle:@"提示"
message:@"單擊了動態按鈕!"
delegate:self
cancelButtonTitle:@"確定"
otherButtonTitles:nil];
[alert show];
[alert release];
}
*'release' is unavailable:not available in automatic reference counting mode
*ARC forbids explicit message send of 'release'
原因及解決辦法:
1)
You need to turn off Automatic Reference Counting. You do this by clicking on your project in the navigator (the top item in the finder-like thing on the left), then click on your target, select "Build Settings" and turn off the option "Objective-C Automatic Reference Counting" (you can use the search field on the upper right to search it).
用的是X-code 4.6,蘋果引入了自動記算引用數的功能,所以老的項目中
[alert release];是報錯的,必須把arc(auto-reference-command)關閉才行,方法如下:
Build Phases--->Apple LLVM compiler 3.0- Language--->Objective-C Automatic Reference Counting 將YES改爲NO
2)
project -> build setting -> Apple LLVM Complier 3.0 – Language -> Objective-C Auto Reference Counting ->
NO 關閉
YES 打開
ARC在編譯階段會產生代碼來處理對象引用數,所以啓用ARC的話,很多retian和release都不需要了
現在xcode默認啓用ARC,關閉的話,要自己補上釋放對象的代碼喲
所以註釋掉代碼:
//[alert release];
【錯誤信息】
@property (weak, nonatomic) IBOutlet UIButton *button1;
如下錯誤:
@synthesize of 'weak' property is only allowed in ARC or GC mode
原因及解決辦法:
strong與weak是由ARC新引入的對象變量屬性
xcode 4.2(ios sdk4.3和以下版本)和之前的版本使用的是retain和assign,是不支持ARC的。xcode 4.3(ios5和以上版本)之後就有了ARC,並且開始使用
strong與weak
疑問:Xcode中新建一個Universal Applications
解答:
iPhone SDK 3.2引入了一種新的通用應用程序格式。這爲開發人員提供了一個簡便的途徑,可以發行同時包含iPhone和iPad版本的單個應用程序包--因此要使用相應的通用名稱。如你所料,如果應用程序被下載到iPad上,就會運行iPad版;如果被下載到iPhone上,就會運行iPhone版。顯然,也可以選擇僅將應用程序編譯爲獨立的iPad應用程序或iPhone應用程序。
作者:水煮魚
出處:http://blog.csdn.net/panfb227