Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Plyer camera cannot save image to the IOS phone #561

Closed
Junhano opened this issue May 9, 2020 · 2 comments
Closed

Plyer camera cannot save image to the IOS phone #561

Junhano opened this issue May 9, 2020 · 2 comments
Labels

Comments

@Junhano
Copy link

Junhano commented May 9, 2020

Error
2020-05-08 21:02:13.732079-0700 chiroview[25063:7296873] Image saved successfully
2020-05-08 21:02:24.039660-0700 chiroview[25063:7296873] [chiroview] IIOImageWriteSession:121: cannot create: '/private/var/containers/Bundle/Application/AC8438C9-24DC-42EF-886B-897FAE254901/chiroview.app/YourApp/test.png.sb-adbcd51c-fbT6Fo'
error = 1 (Operation not permitted)
2020-05-08 21:02:24.039745-0700 chiroview[25063:7296873] Error -> failed to create image destination.

My code

def capture(self):                                                                    
    try:                                                                              
        file_name = "test.png"                                                        
        camera.take_picture(filename = file_name,on_complete = self.camera_callback)  
                                                                                      
    except NotImplementedError:                                                       
        pass                                                                          
                                                                                      
def camera_callback(self, filename):                                                  
    if (exists(filename)):                                                            
        print('Hello')                                                                
    else:                                                                             
        pass       

I don't know what's wrong with my plyer camera. I can successfully start the camera, but when I click cancel, my console says image saved successfully. But when I actually took the picture and try to save it to my phone, it says operation not permitted error. I did some research and find some similar post, but I didn't find a good solution to my problem. The on_complete call back function never gets called. Anyone who knows what's going on can tell me what's wrong with my Plyer Camera?

@prawnydagrate
Copy link

There's nothing wrong with Plyer. It's just that your app doesn't have permission to save files to the iOS device. If you were using Android, then I would have recommended requesting the WRITE_EXTERNAL_STORAGE permission. But I don't know anything about iOS permissions.

@tshirtman
Copy link
Member

on ios, you need to write to a directory where you have permissions to write, you can use the Documents/ directory for that.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants