iCloud plugin on tvos

When using the iCloud plugin on tvos, i get an error.

The same code on iOS works fine, i get the token returned and can save and get data.

To my best knowledge i have the provisioning profiles etc setup correct.

here is my code:

[lua]

main.lua:

print(“Going to call iCloud”)

print(“Calling iCloud to get the identityToken:”,iCloud.identityToken() )

print(“Did Call iCloud”)

build.settings:

tvos =

  {

    iCloud = true,

    – Apple TV app icons consist of multiple “layers” in both small and large sizes

    icon =

    {

      – A collection of 400x240 images, in order from top to bottom

      small =

      {

          “Icon-tvOS-Small-4.png”,

          “Icon-tvOS-Small-3.png”,

          “Icon-tvOS-Small-2.png”,

          “Icon-tvOS-Small-1.png”,

      },

      – A collection of 1280x768 images, in order from top to bottom

      large =

      {

          “Icon-tvOS-Large-4.png”,

          “Icon-tvOS-Large-3.png”,

          “Icon-tvOS-Large-2.png”,

          “Icon-tvOS-Large-1.png”,

      }

    },

    – A 1920x720 image file, displayed when your app is on the “top shelf”

    topShelfImage = “Icon-tvOS-TopShelf.png”,

    – A 1920x1080 image file, displayed briefly as your app loads

    launchImage = “Icon-tvOS-Launch.png”

  },

  plugins =

  {

    [“plugin.iCloud”] =

    {

      publisherId = “com.coronalabs”,

      supportedPlatforms = { iphone=true, appletvos=true, [“iphone-sim”]=true, [“mac-sim”] = true },

    },

   }

[/lua]

and the terminal printout

[lua]

Dec 26 10:50:49 Apple-TV platform01_tvos[633] <Warning>: Going to call iCloud

Dec 26 10:50:49 Apple-TV platform01_tvos[633] <Error>: setting error: Error Domain=NSCocoaErrorDomain Code=4099 “The connection to service named com.apple.bird.token was invalidated.” UserInfo={NSDebugDescription=The connection to service named com.apple.bird.token was invalidated.}

Dec 26 10:50:49 Apple-TV platform01_tvos[633] <Warning>: Calling iCloud to get the identityToken: nil

Dec 26 10:50:49 Apple-TV platform01_tvos[633] <Warning>: Did Call iCloud

[/lua]

My best guess that something is wrong with account you logged in on your tvOS. Try logging out/in. (same goes for simulator if you’re using it). Also make sure you’re using latest tvOS software.

Does error happens on every access to KVS/iCloud call?

okay now i tried log out/ back in to iCloud on the tvOS device.

Issue is still there.

Yes it happens on every access to iCloud 

Please advice 

I can add that i have tried another iCloud account, and still same issue.

regarding simulator:

If i try to build for simulator, when it is finished building and launches the tvOS simulator window it goes black and i get this in the log:

jan. 02 07:48:56.42 5 Runtime Error: Runtime error: module ‘plugin.iCloud’ not found:resource (plugin.iCloud.lu) does not exist in archive

Do you get a similar message from the device when trying to use iCloud?

For the simulator, it might be useful the first time, to comment out the supportedPlatform line and then see if the error goes away, then you can uncomment it out and see if that fixes thing. The iCloud plugin doesn’t work in the simulator, so we have to download a stub to prevent it from erroring out. But it seems that if you specific the supportedPlatform line, the simulator wont always download the stub. Taking it out, lets the simulator fetch the stub then after that you can use the supportedPlatform line (if I understood the engineering chatter about it the other day)

Rob

commenting out the supportedPlatforms allowed to fetch the stub. But as the plugin is not supported on the simulator it didnt get me any closer to fix the issue i had in the first place.

That is, the iCloud plugin do not work on tvOS, while the same code works fine on iOS.

Has anyone been succesfull implementing the iCloud plugin on tvOS? 

Cheers,

Tommy

I didn’t have any issues with it in my game. I just used KVS, nothing fancy, just calling .set() and .get().

It may be a few days before the Engineering can look at this.

Rob

I can confirm that set and get works on tvOS.

I called the identityToken function to check if the device is logged in to iCloud, and that function always returns nil on tvOS

Thanks for the hint, i am very close to finishing up the app now

Cheers,

Tommy

Hi Rob,

commenting out the supported platforms line first and then putting the line in again did the trick, thanks for the tip.

iCloud KVS now works for me on tvOS.

Now only waiting for 

* NSUserDefaults for tvOS offline mode (even if this should never happen),

* Game Center support and

* the missing key events to show up correctly (I would like to use the original Apple events, not the workaround),

then we are good to go. 

​It would be perfect if his would be in before February 12th, because from February 16-18th we are at the Casual Connect Europe in Amsterdam, “Freeze! 2 - Brothers” will be shown in the Indie Showcase and hopefully gets the Award. 

And my contacts from Apple plan to show up, and they want to have a look at the tvOS version that we will showcase, too.

BTW, will Corona Labs be there? Would be a good place to showcase the SDK to lots of European developers.

Best

Andreas

My best guess that something is wrong with account you logged in on your tvOS. Try logging out/in. (same goes for simulator if you’re using it). Also make sure you’re using latest tvOS software.

Does error happens on every access to KVS/iCloud call?

okay now i tried log out/ back in to iCloud on the tvOS device.

Issue is still there.

Yes it happens on every access to iCloud 

Please advice 

I can add that i have tried another iCloud account, and still same issue.

regarding simulator:

If i try to build for simulator, when it is finished building and launches the tvOS simulator window it goes black and i get this in the log:

jan. 02 07:48:56.42 5 Runtime Error: Runtime error: module ‘plugin.iCloud’ not found:resource (plugin.iCloud.lu) does not exist in archive

Do you get a similar message from the device when trying to use iCloud?

For the simulator, it might be useful the first time, to comment out the supportedPlatform line and then see if the error goes away, then you can uncomment it out and see if that fixes thing. The iCloud plugin doesn’t work in the simulator, so we have to download a stub to prevent it from erroring out. But it seems that if you specific the supportedPlatform line, the simulator wont always download the stub. Taking it out, lets the simulator fetch the stub then after that you can use the supportedPlatform line (if I understood the engineering chatter about it the other day)

Rob

commenting out the supportedPlatforms allowed to fetch the stub. But as the plugin is not supported on the simulator it didnt get me any closer to fix the issue i had in the first place.

That is, the iCloud plugin do not work on tvOS, while the same code works fine on iOS.

Has anyone been succesfull implementing the iCloud plugin on tvOS? 

Cheers,

Tommy

I didn’t have any issues with it in my game. I just used KVS, nothing fancy, just calling .set() and .get().

It may be a few days before the Engineering can look at this.

Rob

I can confirm that set and get works on tvOS.

I called the identityToken function to check if the device is logged in to iCloud, and that function always returns nil on tvOS

Thanks for the hint, i am very close to finishing up the app now

Cheers,

Tommy

Hi Rob,

commenting out the supported platforms line first and then putting the line in again did the trick, thanks for the tip.

iCloud KVS now works for me on tvOS.

Now only waiting for 

* NSUserDefaults for tvOS offline mode (even if this should never happen),

* Game Center support and

* the missing key events to show up correctly (I would like to use the original Apple events, not the workaround),

then we are good to go. 

​It would be perfect if his would be in before February 12th, because from February 16-18th we are at the Casual Connect Europe in Amsterdam, “Freeze! 2 - Brothers” will be shown in the Indie Showcase and hopefully gets the Award. 

And my contacts from Apple plan to show up, and they want to have a look at the tvOS version that we will showcase, too.

BTW, will Corona Labs be there? Would be a good place to showcase the SDK to lots of European developers.

Best

Andreas