NSUbiquitousKeyValueStore API not working on macOS Monterey - objective-c

My app uses iCloud key-value storage objective-c api as follows:
NSUbiquitousKeyValueStore* iCloudStorage = [NSUbiquitousKeyValueStore defaultStore];
[iCloudStorage synchronize];
[iCloudStorage setString:#"Test" forKey:#"TestStringKey"];
[iCloudStorage synchronize];
NSString* value = [iCloudStorage stringForKey:#"TestStringKey"];
To use this api i add the following entitlement to the entitlements file:
<key>com.apple.developer.ubiquity-kvstore-identifier</key>
<string>$(TeamIdentifierPrefix)$(CFBundleIdentifier)</string>
Also, I've enabled iCloud support in Certificates, IDs, and Profiles on developer.apple.com for my app identifier, so it looks like as described in the iCloud Key-Value Storage documentation. The problem is that this code works without problems on all MacOS versions before Monterey, but the code does not work on the Monterey version - it is impossible to save the string or retrieve it from the storage and in the logs I see the following messages:
2022-03-15 17:41:17.119843+0300 [Connection] Unable to find entitlement for KVS store
2022-03-15 17:41:17.119888+0300 [Connection] Trying to initialize NSUbiquitousKeyValueStore without a store identifier. Please specify a store identifier in your entitlements or initializer.
After re-reading the documentation for this api and making sure that I have everything set up as described there, I did not find a solution to the problem, so I ask for help.

Related

Branch.io - Android app links DAL json file not updated when SHA256 changed

We are using Branch.io for app links in our application. We have 4 different versions of application for different environments. All versions were working properly with generated app links, but now we need to updated SHA256 fingerpints for our production app as it was published on Play Store using Google's signing keys.
The issue is that after updating SHA256 fingerpints in Branch dashboard content of Digital Asset Links JSON file "/.well-known/assetlinks.json" is not updated even after few days.
What I have tried so far:
- replaced previous SHA256 with a new one
- added new SHA256, as we won't to have 2 SHA256 fingerpints provided in DAL file
- disabled app links for Android just to try triggering DAL file re-generation
Here is example content of DAL json file:
[
{
"relation":["delegate_permission/common.handle_all_urls"],
"target":{
"namespace":"android_app",
"package_name":"<my app package name>",
"sha256_cert_fingerprints":[
"<my app existing sha256 fingerpint>"
]
}
}
]
And I need to have it's "sha256_cert_fingerprints" field updated with new sha256 fingerprint:
[
{
"relation":["delegate_permission/common.handle_all_urls"],
"target":{
"namespace":"android_app",
"package_name":"<my app package name>",
"sha256_cert_fingerprints":[
"<my app sha256 fingerprint for Play Store APK>"
"<my app existing sha256 fingerpint>"
]
}
}
]
Branch declares that they support multiple SHA256 fingerprints:
"You can insert both your debug and production fingerprints for testing. Simply separate them with a comma"
https://docs.branch.io/deep-linking/android-app-links/
None of my attempts helped and "assetlinks.json" DAL file stays unchanged. Does anyone know how to force Branch to generate DAL json file again, so it will include updated SHA256 fingerprints in it?
We ran into the same as you (lost hours on it). You just need to invalidate the contents on the Branch console for your app, save it and update it with actual contents that you need, it should force Branch to update your appLinks.json DAL file (if you are not self-hosting it).

Playscape SDK 1.17 Error!!! Could not retrieve configuration from the server

While building the game with the latest Playscape SDK (1.17), there is an error that says: "Error!!! Could not retrieve configuration from the server."
Surprisingly for me, I realized that the playscape api key field was containing the incorrect key.

NSFileManager's ubiquityIdentityToken always returning null, even when logged in

My Mac application in Xcode has recently begun exhibiting strange symptoms when attempting to access iCloud. There haven't been any changes to my provisioning profiles, code signing identities, etc.
However, when running this code:
id token = [fileManager ubiquityIdentityToken];
NSLog(#"Token is: %#", token);
NSURL *iCloudURL = [fileManager URLForUbiquityContainerIdentifier:nil];
NSLog(#"iCloud URL is: %#", iCloudURL);
The output is:
2013-10-28 08:17:12.372 MyApp[21101:303] Token is: (null)
2013-10-28 08:17:12.373 MyApp[21101:303] iCloud URL is: (null)
Which I find extremely strange, especially considering I am actually signed into iCloud on this machine. To be sure, I ran a quick test with Calendar, adding an event on an iPhone and ensuring that it showed up on the Calendar on my Mac.
But I was under the impression that [fileManager ubiquityIdentityToken]; would return whether the user was logged into iCloud, regardless of whether your entitlements, code signing, etc. was properly configured - indicating that it's less an issue on my end, and more an issue of the system's ability to return this value.
I have tried logging out (and back in) to iCloud, and have ensured that "Documents & Data" is enabled in the iCloud settings.
This was resolved by upgrading from the original Mavericks GM (build 13A598) to the official release (build 13A603.)

Current receipt invalid or mismatched ds person id + Included images

I'm setting up In-App purchasing for my Mac App. I currently am able to get the product from iTunes Connect, and even request a purchase. I'm pretty stumped with this error message, and am really hoping someone has been here before and can offer some assistance.
I am getting the (very helpful) localized error: Transaction error: Unknown Error.
I've included the two images of successful Mac App Store authentication, and error message. All I'm able to figure out is that the failedTransaction is being called from the SKPaymentTransaction.
Here's what I did. Archive in Xcode. Then distribute -> mac installer -> double-click .pkg file & install.
That seems to download the _MASReceipt and all is well when including
if(![[NSFileManager defaultManager] fileExistsAtPath:[[[NSBundle mainBundle] appStoreReceiptURL] path]]) {
NSLog(#"to get sandbox receipt, the app must be launched from outside xcode");
exit(173);
}

deny mach-loop server

I my application I have two target. I need to communicate between the two target. So I register one app as server which has been given an identifier and server name.
I have tried to retrieve the proxy by using the following code. The identifier name has been set to second target. When I call the server object from the second target as under, i got deny mach-loop in the console.
id proxy = nil;
proxy = [[NSConnection rootProxyForConnectionWithRegisteredName:#"MYSERVER"
host:nil] retain];
The above proxy object I could get when I disabled the sandboxing. But, when i enabled the sandboxing i could not get the proxy object. What could be the reason behind this.
Regards,
The Distributed Objects connection being prevented by the sandbox.
It sounds like you need to read about how the sandbox works.
XPC might be a good alternative to Distributed Objects, depending on what you're trying to accomplish.
We can do so by using the entitlement property. We have to set the bundle identifier of one another app here is the link:
http://developer.apple.com/library/mac/#documentation/Miscellaneous/Reference/EntitlementKeyReference/Chapters/EnablingAppSandbox.html#//apple_ref/doc/uid/TP40011195-CH4-SW5