drewmccormack / ensembles

A synchronization framework for Core Data.
MIT License
1.63k stars 132 forks source link

Error in leech #207

Closed Spokane-Dude closed 8 years ago

Spokane-Dude commented 8 years ago

Hi Drew... First run, trying to get past the initial leech... I'm getting this error:

Error in leech: Error Domain=CDEErrorDomain Code=1003 "User is not logged into iCloud." UserInfo={NSLocalizedDescription=User is not logged into iCloud.}

What do you think the problem is?

drewmccormack commented 8 years ago

Have you setup iCloud for your app at developer.apple.com http://developer.apple.com/? You need an iCloud container there. Did you setup iCloud in the Capabilities tab? You need iCloud Documents. Maybe send me a screenshot. Also, take a look at the Simple Sync example app, and compare it to your setup.

Drew

On 07 Dec 2015, at 18:14, Rolf Marsh notifications@github.com wrote:

Hi Drew... First run, trying to get past the initial leech... I'm getting this error:

Error in leech: Error Domain=CDEErrorDomain Code=1003 "User is not logged into iCloud." UserInfo={NSLocalizedDescription=User is not logged into iCloud.}

I am logged in to iCloud running on the latest iOS (9.1), Objective-C and XCode 7.1 This is the ubiquityContainerIdentifier from the debug run: ubiquityContainerIdentifier __NSCFConstantString * @"iCloud.com.pragerphoneapps.BookstoreInventoryManager" 0x00155768 no build errors (I have -lc and -ObjC parameters in my app, ensembles and pods targets What else do you want me to check?

— Reply to this email directly or view it on GitHub https://github.com/drewmccormack/ensembles/issues/207.

drewmccormack commented 8 years ago

What do you get returned by cloudIdentityToken and the container URL method from NSFileManager? They need to return non-nil values if iCloud is setup properly.

Kind regards, Drew

On 07 Dec 2015, at 19:00, Rolf Marsh notifications@github.com wrote:

I have the iCloud container, if that's what you are referring to:

— Reply to this email directly or view it on GitHub.

drewmccormack commented 8 years ago

It is a method on NSFileManager. It is standard iCloud, not ensembles.

See the Apple docs for more info.

Once you have iCloud setup and working, Ensembles should then work.

Kind regards, Drew

On 07 Dec 2015, at 19:18, Rolf Marsh notifications@github.com wrote:

Are you referring to the ubiquityIdentityToken? If so, this is what is returned: ubiquityContainerIdentifier __NSCFConstantString * @"iCloud.com.pragerphoneapps.BookstoreInventoryManager" 0x00166768 If not, I have no idea of what you are referring to; I did a search and found nothing in my app or Simple Sync.

Regards, Rolf

— Reply to this email directly or view it on GitHub.

Spokane-Dude commented 8 years ago

Hi Drew... well, after messing with both the iPad and iMac all day, I have determined that I can access iCloud using the same account on both devices (iPad and iMac) through iCloud.com.

When I try this code in my app, I get 'nil' for all three methods. id currentiCloudToken = [[NSFileManager defaultManager] ubiquityIdentityToken]; NSURL *url = [[NSFileManager defaultManager] URLForUbiquityContainerIdentifier:@"iCloud.com.pragerphoneapps.BookstoreInventoryManager"]; id myContainer = [[NSFileManager defaultManager] URLForUbiquityContainerIdentifier: nil];

If I remove the Ensembles code prior to these three statements, I still get nil. So, what or where do I check next? I have rebooted the iMac and the iPad; I'm at a loss now as to what it could be.

Regards, Rolf

drewmccormack commented 8 years ago

At this point you are better to Google for iiCloud troubleshooting than actually Ensembles. This is purely an Apple/iCloud issue now.

Here are some things I can think to check:

Drew

On 08 Dec 2015, at 05:12, Rolf Marsh notifications@github.com wrote:

Hi Drew... well, after messing with both the iPad and iMac all day, I have determined that I can access iCloud using the same account on both devices (iPad and iMac) through iCloud.com.

When I try this code in my app, I get 'nil' for all three methods. id currentiCloudToken = [[NSFileManager defaultManager] ubiquityIdentityToken]; NSURL *url = [[NSFileManager defaultManager] URLForUbiquityContainerIdentifier:@"iCloud.com.pragerphoneapps.BookstoreInventoryManager"]; id myContainer = [[NSFileManager defaultManager] URLForUbiquityContainerIdentifier: nil];

If I remove the Ensembles code before these three statements, I still get nil. So, what or where do I check next? I have rebooted the iMac and the iPad; I'm at a loss now as to what it could be.

Regards, Rolf

— Reply to this email directly or view it on GitHub https://github.com/drewmccormack/ensembles/issues/207#issuecomment-162754619.

Spokane-Dude commented 8 years ago

Hi Drew... Apple Tech Support found the culprit and I thought I would pass it on to you to add to your arsenal of tips...

"When I run codesign tool on your built binary, it’s missing these
entitlements:

com.apple.developer.icloud-container-identifiers
com.apple.developer.icloud-services
com.apple.developer.ubiquity-container-identifiers

For some strange reason Xcode is stripping your final entitlements
of those important keys.

To fix this, go into Build Settings, and delete the Code Signing
Entitlements setting, this will in effect remove your old
entitlements file and revert your iCloud capabilities.  Go back to
iCloud Capabilities and turn back on iCloud, and re-check the
“iCloud Document” services again.  This will re-create a new
entitlements file.  The kicker here is Xcode was showing “Any SDK”
for the debug target.  By following this fix, (delete and re-add the
entitlement file), this removes that “Any SDK” setting, which is the
culprit.

I verified your project (with my own container ID), and the NSURL is
valid for the ubiquity container."

I am now able to connect to iCloud on my iPad through my app...

Regards, Rolf

On 12/7/15 11:16 PM, Drew McCormack wrote:

At this point you are better to Google for iiCloud troubleshooting than actually Ensembles. This is purely an Apple/iCloud issue now.

Here are some things I can think to check:

  • Did you go into iCloud Settings on the device and make sure iCloud Drive was turned on?
  • Did you add an iCloud container in the provisioning portal?
  • Did you add iCloud to your App ID in the provisioning portal at developer.apple.com? (screenshot)
  • Is your iPhone registered in the provisioning portal?
  • If it still doesn’t work, have you tried creating a development provisioning profile for the app?
  • Not sure if this is the case, but is the iCloud account you are trying to test associated with your develop account? Perhaps you need to add it as one of the ‘People’ in your team.
  • Googling ‘ubiquityIdentityToken is nil’ returns a lot of hits. This looks useful: https://devforums.apple.com/thread/229509

Drew

On 08 Dec 2015, at 05:12, Rolf Marsh notifications@github.com wrote:

Hi Drew... well, after messing with both the iPad and iMac all day, I have determined that I can access iCloud using the same account on both devices (iPad and iMac) through iCloud.com.

When I try this code in my app, I get 'nil' for all three methods. id currentiCloudToken = [[NSFileManager defaultManager] ubiquityIdentityToken]; NSURL *url = [[NSFileManager defaultManager] URLForUbiquityContainerIdentifier:@"iCloud.com.pragerphoneapps.BookstoreInventoryManager"]; id myContainer = [[NSFileManager defaultManager] URLForUbiquityContainerIdentifier: nil];

If I remove the Ensembles code before these three statements, I still get nil. So, what or where do I check next? I have rebooted the iMac and the iPad; I'm at a loss now as to what it could be.

Regards, Rolf

— Reply to this email directly or view it on GitHub https://github.com/drewmccormack/ensembles/issues/207#issuecomment-162754619.

— Reply to this email directly or view it on GitHub https://github.com/drewmccormack/ensembles/issues/207#issuecomment-162797856.

drewmccormack commented 8 years ago

Hi Rolf, Thanks for sharing this. What a mess, huh? So it sounds like a straight up Xcode bug. Kind regards, Drew

On 15 Dec 2015, at 22:25, Rolf Marsh notifications@github.com wrote:

Hi Drew... Apple Tech Support found the culprit and I thought I would pass it on to you to add to your arsenal of tips...

"When I run codesign tool on your built binary, it’s missing these entitlements:

com.apple.developer.icloud-container-identifiers com.apple.developer.icloud-services com.apple.developer.ubiquity-container-identifiers

For some strange reason Xcode is stripping your final entitlements of those important keys.

To fix this, go into Build Settings, and delete the Code Signing Entitlements setting, this will in effect remove your old entitlements file and revert your iCloud capabilities. Go back to iCloud Capabilities and turn back on iCloud, and re-check the “iCloud Document” services again. This will re-create a new entitlements file. The kicker here is Xcode was showing “Any SDK” for the debug target. By following this fix, (delete and re-add the entitlement file), this removes that “Any SDK” setting, which is the culprit.

I verified your project (with my own container ID), and the NSURL is valid for the ubiquity container."

I am now able to connect to iCloud on my iPad through my app...

Regards, Rolf

On 12/7/15 11:16 PM, Drew McCormack wrote:

At this point you are better to Google for iiCloud troubleshooting than actually Ensembles. This is purely an Apple/iCloud issue now.

Here are some things I can think to check:

  • Did you go into iCloud Settings on the device and make sure iCloud Drive was turned on?
  • Did you add an iCloud container in the provisioning portal?
  • Did you add iCloud to your App ID in the provisioning portal at developer.apple.com? (screenshot)
  • Is your iPhone registered in the provisioning portal?
  • If it still doesn’t work, have you tried creating a development provisioning profile for the app?
  • Not sure if this is the case, but is the iCloud account you are trying to test associated with your develop account? Perhaps you need to add it as one of the ‘People’ in your team.
  • Googling ‘ubiquityIdentityToken is nil’ returns a lot of hits. This looks useful: https://devforums.apple.com/thread/229509

Drew

On 08 Dec 2015, at 05:12, Rolf Marsh notifications@github.com wrote:

Hi Drew... well, after messing with both the iPad and iMac all day, I have determined that I can access iCloud using the same account on both devices (iPad and iMac) through iCloud.com.

When I try this code in my app, I get 'nil' for all three methods. id currentiCloudToken = [[NSFileManager defaultManager] ubiquityIdentityToken]; NSURL *url = [[NSFileManager defaultManager] URLForUbiquityContainerIdentifier:@"iCloud.com.pragerphoneapps.BookstoreInventoryManager"]; id myContainer = [[NSFileManager defaultManager] URLForUbiquityContainerIdentifier: nil];

If I remove the Ensembles code before these three statements, I still get nil. So, what or where do I check next? I have rebooted the iMac and the iPad; I'm at a loss now as to what it could be.

Regards, Rolf

— Reply to this email directly or view it on GitHub https://github.com/drewmccormack/ensembles/issues/207#issuecomment-162754619.

— Reply to this email directly or view it on GitHub https://github.com/drewmccormack/ensembles/issues/207#issuecomment-162797856.

— Reply to this email directly or view it on GitHub.

Spokane-Dude commented 8 years ago

They (Apple TS) asked me to submit a RADAR on it... submitted: RADAR 24021589

pronebird commented 8 years ago

This "Any SDK" thing has been giving me a lot of trouble in past years regarding code sign. I can confirm that sometimes it messes things up.

sumowesley commented 8 years ago

Just following on from this, I received the same error message (not logged in) and the sequence of deleting and regenerating the iCloud capabilities seems to have got over that hurdle. Many thanks.