Greetings! We are trying to implement the new media.selectPhoto for our app. But when we try to use the sample code at the api, it’s not working for iPad but for iPhone and iPod it works fine. We are able to access the gallery and choose one, after that the gallery closes and nothing shows on the screen. This issue only happens on iPad, we tried it both on iPad4 and iPad2 and it showed the same problem.
Did you comment one of the selectPhotos out? There are 2 in the sample code in the docs.
Yep. I did and It works on iPhone and iPod and not on iPad.
Please attach the sample project your are using.
local button = display.newRect(120,240,80,70)
local function onComplete(event)
local photo = event.target
print( “onComplete called …” )
if photo then
print( "photo w,h = " … photo.width … “,” … photo.height )
end
end
– Button tap listener
local function pickPhoto( event )
– Note: Only use one of the media.show routines listed below
--[[ Save photo to file in Temporary directory
media.selectPhoto(
{
mediaSource = media.PhotoLibrary
listener = onComplete,
origin = button.contentBounds,
permittedArrowDirections = { “right” },
destination = {baseDir=system.TemporaryDirectory, filename=“image.jpg”, type=“image”}
} ) --]]
– Show photo on screen (no file save)
media.selectPhoto(
{
mediaSource = media.SavedPhotosAlbum,
listener = onComplete,
origin = button.contentBounds,
permittedArrowDirections = { “right” }
} )
end
button:addEventListener(“tap”, pickPhoto )
This is the exact thing from the api.
What version of Corona are you using? What version of iOS are on those devices?
Did you comment one of the selectPhotos out? There are 2 in the sample code in the docs.
Yep. I did and It works on iPhone and iPod and not on iPad.
Please attach the sample project your are using.
local button = display.newRect(120,240,80,70)
local function onComplete(event)
local photo = event.target
print( “onComplete called …” )
if photo then
print( "photo w,h = " … photo.width … “,” … photo.height )
end
end
– Button tap listener
local function pickPhoto( event )
– Note: Only use one of the media.show routines listed below
--[[ Save photo to file in Temporary directory
media.selectPhoto(
{
mediaSource = media.PhotoLibrary
listener = onComplete,
origin = button.contentBounds,
permittedArrowDirections = { “right” },
destination = {baseDir=system.TemporaryDirectory, filename=“image.jpg”, type=“image”}
} ) --]]
– Show photo on screen (no file save)
media.selectPhoto(
{
mediaSource = media.SavedPhotosAlbum,
listener = onComplete,
origin = button.contentBounds,
permittedArrowDirections = { “right” }
} )
end
button:addEventListener(“tap”, pickPhoto )
This is the exact thing from the api.
What version of Corona are you using? What version of iOS are on those devices?