2015-01-12 9 views
7

में मूव एंड स्केल के बाद फ़ोटो को अनुमति देने से इंकार कर देता है, मैं डिफ़ॉल्ट UIImagePickerController का उपयोग कर रहा हूं जिसमें फ़ोटो लेने के लिए YES पर सेट करने की अनुमति है। जब उपयोगकर्ता फोटो चलाता है और स्केल करता है, तो ओएस 'फ़ोटो' तक पहुंच के लिए पूछता है। यदि उपयोगकर्ता पहुंच से इनकार करता है तो ऐप क्रैश हो जाता है।आईओएस ऐप दुर्घटनाग्रस्त हो जाता है जब उपयोगकर्ता UIImagePickerController

- (void)openCamera 
{ 
    UIImagePickerController *imagePickerController = [[UIImagePickerController alloc] init]; 
    imagePickerController.editing = YES; 
    imagePickerController.allowsEditing = YES; 
    imagePickerController.sourceType = UIImagePickerControllerSourceTypeCamera; 
    imagePickerController.delegate = self; 
    [self presentViewController:imagePickerController animated:YES completion:nil]; 
} 

और UIImagePickerControllerDelegate विधि

- (void) imagePickerController:(UIImagePickerController *)picker didFinishPickingMediaWithInfo:(NSDictionary *)info { 

    UIImage *image = info[UIImagePickerControllerEditedImage]; 
    if (!image) { 
     image = info[UIImagePickerControllerOriginalImage]; 
    } 

    self.profileImage = image; 

    [picker dismissViewControllerAnimated:YES completion:nil]; 
} 

क्रैश संदेश प्रकार है:

*** This application is not allowed to access Photo data. 

मैं सोच रहा हूँ क्यों यह पहली जगह में फ़ोटो तक पहुंच के लिए पूछना चाहिए। कोई विचार?

+0

ट्वीटबॉट ऐप के साथ मामले का परीक्षण किया। वहाँ भी दुर्घटनाग्रस्त हो जाता है। एक ओएस मुद्दा लगता है। –

+0

मैं कैमरे को पेश करने से पहले "फोटो" अनुमति की जांच करने का सुझाव दूंगा क्योंकि आप संपादन की अनुमति देते हैं जो फ़ोटो तक पहुंच की आवश्यकता होती है। – rmaddy

+0

क्या आप इसका कोई समाधान ठीक करते हैं। –

उत्तर

2

यह जांचने के लिए संपत्ति फ्रेमवर्क का उपयोग करें कि क्या आपके ऐप को फोटो डेटा तक पहुंचने की अनुमति है या नहीं।

ALAuthorizationStatus status = [ALAssetsLibrary authorizationStatus]; 

    if(status==ALAuthorizationStatusAuthorized) { 
     ..your code... 
    } 
संबंधित मुद्दे