iCloud file storage not available in OS X

I am getting an iCloud docListener event.isError = true in an app that runs in OS X.

All provisioning profiles etc. appear ok as an XCode app that correctly runs accesses the same iCloud container defined in the provisioning profile.

My code:

local iCloud = require( "plugin.iCloud" ) local function docListener( event ) print("####JTD idocListener called" ) if event.isError then print( "####JTD iCloud file storage is not available!" ) else print( "####JTD iCloud file storage is available!" ) local id = iCloud.identityToken() if id ~= nil then print ("####JTD iCloud.identityToken:" .. id) else print ("####JTD iCloud.identityToken:" .. "nil") end end end iCloud.docInit( { onComplete=docListener } ) print("####JTD iCLoudHandler loaded" )

My console:

Platform: iMac12,1 / x86_64 / 10.11.3 / AMD Radeon HD 6750M OpenGL Engine / 2.1 ATI-1.40.16 / 2016.2830 / en-US | IT | en_IT | en

####JTD iCLoudHandler loaded

####JTD idocListener called

####JTD iCloud file storage is not available!

My settings are:

plugins = { ["plugin.iCloud"] = { publisherId = "com.coronalabs", supportedPlatforms = { iphone=false, appletvos=false, osx=true } }, }, osx = { iCloud = true, entitlements = { }, },

Any hint ?

Have you tried removing 

entitlements = {
},

?

iCloud requires entitlements. “iCloud=true” just tries to extract entitlements from provisioning profile.

@vlads

Yes I tried both cases. Removing entitlements = { } does not change the behaviour.

The iCloud.docInit is called juts after the app launch and it immediately returns event.isError true.

Is that correct ? I mean: shall I implement retries delayed in time for docInit ?

  1. Retries would not help for sure. I would recommend to print whole event output - it may contain additional info, other than “isError=true”. You can do it with [lua]print(json.prettify(event))[/lua]

  2. What does console outputs? You can check by running your app from command line (like /Applications/TextEdit.app/Contents/MacOS/TextEdit) or checking out Console app.

  3. Third option to look into is to check entitlements of the signed app. Something like

    codesign -d -v --entitlements  :- /Applications/TextEdit.app/

Hey were you guys able to figure this out?  I’m using KVS storage only (not the iCloud containers), but haven’t gotten this to work yet in OSX…

  1. Btw, Corona writes entitlements only when you sign your app for App Store submission.

You can manually try to add entitlements with this entry in build settings.

[lua]entitlemets = {

    [“com.apple.developer.team-identifier”] = “8TEAM_ID8”,

    – KVS

    [“com.apple.developer.ubiquity-kvstore-identifier”] = “8TEAM_ID8.com.coronalabs.TestApp”,

    – CloudKit and CloudDocuments

    [“com.apple.developer.icloud-container-environment”] = { “Development”, “Production” },

    [“com.apple.developer.icloud-container-identifiers”] = {“iCloud.com.coronalabs.TestApp”},

    [“com.apple.developer.icloud-services”] = { “CloudDocuments”, “CloudKit” },

},[/lua]

Make sure to replace 8TEAM_ID8 and com.corona.TestApp and generally adjust to what you’re trying to do.

To get this values, you can query your provisioning profile with 

security cms -D -i profile.mobileprovision

and look for Entitlements section.

Also, it would be nice to provide info requested in my previous post first.

I’m sorry. I can’t really help without you providing output of commands in my previous 2 replies + console output.

Oops sorry bout that…   So, running my OSX app, here’s what I get from terminal:

...(some other stuff)... 2016-03-22 16:03:18.894 Alpha Omega[27136:3457366] NSUbiquitousKeyValueStore error: com.borderleap.alphaomega.osx does not have a valid com.apple.developer.ubiquity-kvstore-identifier entitlement

what about output of other commands?

Not sure what commands you’re referring to…  I’m not having any other errors.  

codesign -d -v --entitlements  :- /Applications/XXXX.app/

security cms -D -i XXXX.mobileprovision

Also, iCloud available only for applications distributed through Mac App Store, as I wrote, I asked if your app is built for with AppStore distribution provisioning profile.

I’m building it using my distribution profile and opening the app on my Mac.   I’m trying out a few things and will get back to you…

I just noticed something bad. May I ask to do same with tomorrows daily build? There is something weird about OS X provisioning profiles, and I added workaround. Current build can result in bad entitlements (you’ll get error message in console, but build will succeed)

Sounds great - I responded in other thread…

OK. Tanks for your patience. It seems that 2016.2846 signs a valid binary, with proper entitlements for KVS and other iCloud services. Sorry for inconvenience. Download latest build and try again.

Reminder. To make OS X synchronize between iOS and tvOS you’ll have to set it’s kvs store ID, because OS X app probably will have different app ID that your iOS/tvOS app which can share it. Here’s small example (for explanations look on iCloud plugin doc page); distilled version of build.settings from Corona Cannon:

[lua]

settings = {

    iphone = {

        iCloud = true,

    },

    tvos = {

        iCloud = true,

    },

    osx = {

        iCloud = {[‘kvstore-identifier’] = ‘com.coronalabs.coronacannon’},

    },

    plugins = {

        [‘plugin.iCloud’] = {publisherId = ‘com.coronalabs’, supportedPlatforms = {iphone = true, appletvos = true, osx = true}},

    },

}

[/lua]

Have you tried removing 

entitlements = {
},

?

iCloud requires entitlements. “iCloud=true” just tries to extract entitlements from provisioning profile.

@vlads

Yes I tried both cases. Removing entitlements = { } does not change the behaviour.

The iCloud.docInit is called juts after the app launch and it immediately returns event.isError true.

Is that correct ? I mean: shall I implement retries delayed in time for docInit ?

  1. Retries would not help for sure. I would recommend to print whole event output - it may contain additional info, other than “isError=true”. You can do it with [lua]print(json.prettify(event))[/lua]

  2. What does console outputs? You can check by running your app from command line (like /Applications/TextEdit.app/Contents/MacOS/TextEdit) or checking out Console app.

  3. Third option to look into is to check entitlements of the signed app. Something like

    codesign -d -v --entitlements  :- /Applications/TextEdit.app/

Hey were you guys able to figure this out?  I’m using KVS storage only (not the iCloud containers), but haven’t gotten this to work yet in OSX…

  1. Btw, Corona writes entitlements only when you sign your app for App Store submission.

You can manually try to add entitlements with this entry in build settings.

[lua]entitlemets = {

    [“com.apple.developer.team-identifier”] = “8TEAM_ID8”,

    – KVS

    [“com.apple.developer.ubiquity-kvstore-identifier”] = “8TEAM_ID8.com.coronalabs.TestApp”,

    – CloudKit and CloudDocuments

    [“com.apple.developer.icloud-container-environment”] = { “Development”, “Production” },

    [“com.apple.developer.icloud-container-identifiers”] = {“iCloud.com.coronalabs.TestApp”},

    [“com.apple.developer.icloud-services”] = { “CloudDocuments”, “CloudKit” },

},[/lua]

Make sure to replace 8TEAM_ID8 and com.corona.TestApp and generally adjust to what you’re trying to do.

To get this values, you can query your provisioning profile with 

security cms -D -i profile.mobileprovision

and look for Entitlements section.

Also, it would be nice to provide info requested in my previous post first.