我發現這個Color Picker在線,我目前正試圖將其實施到我的代碼。我遵循所有的指示來實現它,但是當我嘗試加載隨代碼一起提供的ViewController(使用UITableView單元格)時,當我嘗試構建和/或運行代碼時,出現Apple Mach-o Linker Error:爲什麼這個ViewController崩潰我的代碼?
Undefined symbols for architecture armv7: "_OBJC_CLASS_$_ColorPickerViewController", referenced from: objc-class-ref in ClockSettingsViewController.o ld: symbol(s) not found for architecture armv7
我所做的就是在崩潰時將視圖加載到層次結構中(下一行是我呈現視圖的那一行)。我在Xcode單獨構建每一個部分,發現這行代碼是錯誤的來源:
ColorPickerViewController *colorView = [[ColorPickerViewController alloc] init];
這代碼坐在這裏:
- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath {
if (indexPath.row == 0) {
ColorPickerViewController *colorView = [[ColorPickerViewController alloc] init];
[self presentViewController:colorView animated:YES completion:nil];
}
}
我已經使用這個方法打開視圖數百次(實際上,這是我使用過的唯一方式),所以我知道它不是代碼本身,而且我到處檢查並導入了我需要的所有東西。什麼是錯的,錯誤是什麼意思,所以我可以在將來修復它。先謝謝了。
非常感謝!這就是訣竅!我會確保下次檢查! – 2012-08-01 20:23:19