Jump to content

[TOPIC: topicViewTemplate]
[GLOBAL: userSmallPhoto]
Photo

Checking for Photo Library access on iOS
Started by HeyItsPete Oct 16 2018 06:26 PM

1 reply to this topic
ios photo library camera
[TOPIC CONTROLS]
This topic has been archived. This means that you cannot reply to this topic.
[/TOPIC CONTROLS]
[modOptionsDropdown]
[/modOptionsDropdown]
[reputationFilter]
[TOPIC: post.html]
#1

HeyItsPete

[GLOBAL: userInfoPane.html]
HeyItsPete
  • Observer

  • 2 posts
  • Corona SDK

Hello! I'm new to Corona and working on my first project, an art app that will be saving the end result to the user's photo library. I have that working exactly how I like it using "display.capture". However, prior to saving the image I'd like to check to make sure the user has enabled access to save photos to the photo library, and for the life of me I can't figure out a way to do that.

 

I'm developing for iOS only and have tested the following on my iPad Air (running iOS 11) and iPhone SE (running iOS 12). I'm running the latest Corona daily build (2018.3407)

 

From what I've read in the documentation, this should (theoretically) do what I need it to:

local hasAccessToPhotos, hasPhotos = media.hasSource( media.PhotoLibrary )
if (hasAccessToPhotos == true) then
   -- save the image to the photo library
else
   -- user has disabled access to the photo library, ask them to turn it on	
end

I expected that "hasAccessToPhotos" would be true only if the user has granted permission for the app to access the photo library, and would return "false" if photo library access was disabled. In all of my tests, "hasAccessToPhotos" is returning true, even when I go into the iOS settings screen and disable it.

 

 

I've had a lot of coffee today trying to figure this out and no luck - I'm guessing either I misunderstood what media.hasSource is supposed to do, or there is a bug of some kind, or I've just been staring at a screen for too long and nothing makes sense anymore :) Would greatly appreciate any help! Thanks :)



[TOPIC: post.html]
#2

HeyItsPete

[GLOBAL: userInfoPane.html]
HeyItsPete
  • Observer

  • 2 posts
  • Corona SDK

Just bumping this again, curious if anyone has any ideas I should try. Thanks!




[topic_controls]
[/topic_controls]