2009-05-14 15 views

Respuesta

52
#if TARGET_IPHONE_SIMULATOR 
[self.imagePicker setSourceType:UIImagePickerControllerSourceTypePhotoLibrary]; 
#else 
[self.imagePicker setSourceType:UIImagePickerControllerSourceTypeCamera]; 
#endif 
11

Para el registro, aquí hay otro método que Apple utiliza en algunos de sus Código de ejemplo oficial:

#if TARGET_CPU_ARM 
    // Only executes on an iPhone or iPod touch device 
    [self.imagePicker setSourceType:UIImagePickerControllerSourceTypeCamera]; 
#else 
    // Only executes on the Simulator 
    [self.imagePicker setSourceType:UIImagePickerControllerSourceTypePhotoLibrary]; 
#endif 
+2

En En este caso, parece que el código de muestra de Apple es incorrecto, este código es Romper si cambian arquitecturas para dispositivos (o Mac). – ThomasW

Cuestiones relacionadas