Thanks, that took care of the photo but now I get a black screen after clicking save on the photo. I even added to show a message after it saves so I know it is about to start the login for Facebook which never shows. So who will it not show it? Below is my code:
MAIN:
local facebook = require "facebook"
local appId = "1234567890"
local onComplete = function(event)
local photo = event.target
photo.isVisible = false
media.save("picture1.jpg")
--print( "photo w,h = " .. photo.width .. "," .. photo.height )
native.showAlert( "Corona", "About to login to Facebook next.", { "OK" } )
facebook.login( appId, fbListener, { "publish\_stream" } )
end
if media.hasSource( media.Camera ) then
media.show( media.Camera, onComplete )
else
native.showAlert( "Corona", "This device does not have a camera.", { "OK" } )
end
local function fbListener( event )
if event.isError then
native.showAlert( "ERROR", event.response, { "OK" } )
else
if event.type == "session" and event.phase == "login" then
-- login was a success; call function
onLoginSuccess()
elseif event.type == "request" then
-- this block is executed upon successful facebook.request() call
native.showAlert( "Success", "The photo has been uploaded.", { "OK" } )
end
end
end
local function onLoginSuccess()
-- Upload 'iheartcorona.jpg' to current user's account
local attachment = {
message = "Just a description of the photo.",
source = { baseDir=system.ResourceDirectory, filename="picture1.jpg", type="image" }
}
facebook.request( "me/photos", "POST", attachment )
end
BUILD:
-- Supported values for orientation:
-- portrait, portraitUpsideDown, landscapeLeft, landscapeRight
settings = {
orientation = {
default = "portrait",
supported = { "portrait", }
},
iphone = {
plist = {
UIStatusBarHidden = false,
UIPrerenderedIcon = true, -- set to false for "shine" overlay
--UIApplicationExitsOnSuspend = true, -- uncomment to quit app on suspend
--[[
-- iOS app URL schemes:
CFBundleURLTypes =
{
{
CFBundleURLSchemes =
{
"fbXXXXXXXXXXXXXX", -- example scheme for facebook
"coronasdkapp", -- example second scheme
}
}
}
--]]
}
},
androidPermissions = {
"android.permission.INTERNET",
"android.permission.CAMERA",
"android.permission.WRITE\_EXTERNAL\_STORAGE",
},
}
[import]uid: 184193 topic_id: 32655 reply_id: 129845[/import]