function writelog(content)
if (Launcher.platform == "android" or Launcher.platform == "ios") then
local path = CCFileUtils:sharedFileUtils():getWritablePath()
local fileName = path.. "debug.log"
local newContent = ""..(os.time{year=2010, month=1, day=1, hour=0,min=1, sec=1}).."] "..content.."\n"
local mode = "a"
local file = io.open(fileName, mode)
if file then
if file:write(newContent) == nil then
print('write failed '..newContent)
end
io.close(file)
else
print('open log failed')
end
end
end
想做个真机的log,在ios上没有问题,android上无法创建文件,哪位大哥知道什么问题?