是否有针对我的模拟器而不是我的设备的编译器指令,可用于编译不同的代码行。就像是:
# IF SIMULATOR
[self.imagePicker setSourceType:UIImagePickerControllerSourceTypePhotoLibrary];
# ELSE
[self.imagePicker setSourceType:UIImagePickerControllerSourceTypeCamera];
# END
编辑
Direct link to docs.
最佳答案
#if TARGET_IPHONE_SIMULATOR
[self.imagePicker setSourceType:UIImagePickerControllerSourceTypePhotoLibrary];
#else
[self.imagePicker setSourceType:UIImagePickerControllerSourceTypeCamera];
#endif
关于ios - 在模拟器中而不是在设备上运行时进行条件编译,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/864920/