tl;dr Does anyone prefix their shared App Group name with their TeamId?
We use an App Group for sharing data between our app and extension, and with another app of ours. I've been passing the suite name as "group.com.example" to NSUserDefaults -initWithSuiteName and NSFileManager -containerURLForSecurityApplicationGroupIdentifier and it's been working fine.
With iOS 10 I'm seeing an Xcode console error when starting my app:
[User Defaults] Failed to read values in CFPrefsPlistSource.
Using kCFPreferencesAnyUser with a container is only allowed for System Containers,
detaching from cfprefsd
A known solution is to prefix our TeamId to the group, but we already have an app out there using the non-prefixed variant, so changing it in this new app will cause compatibility issues. Other than this msg on startup there's no discernible problem.
Here's what makes me wary: We shipped a similar Mac app a few months ago and were hit with an App Store validation error that forced us to use the TeamID on the Mac:
Invalid Code Signing Entitlements. Your application bundle's signature
contains code signing entitlements that are not supported on Mac OS X.
Specifically, value '[group.com.example]' for key
'com.apple.security.application-groups' is not supported. This value
should be a string or an array of strings, each starting with
your TEAMID followed by a dot '.' .
Apple's docs and sample code don't mention the TeamID prefix at all, and my hunch is this isn't a change they'd be able to make without breaking a huge number of apps out there, but if this is a direction Apple is moving I'd rather deal with it now than later.
Does anyone have any authoritative knowledge about using the TeamID prefix or not on iOS? Anyone run into problems using it, or not?
Related
I'm writing an iOS app that includes a Messages extension. To share data between them I created an app group with a key similar to "group.com.myCompany.myApp". The app stores an array of strings using userDefaults.set(:forKey:). Then the app can fetch or modify the array, and the extension can fetch (but not modify) the array.
Both the app and the extension are accessing the UserDefaults using UserDefaults(suiteName:). Both the app and the extension are using the same value for the suite name.
The problem I'm having is that this works just fine in the simulator but on the phone the extension doesn't see the array of strings. I'm completely at a loss.
It's the entitlements!
Earlier, in response to a post that has since been deleted, I wrote "the entitlement files are correct as far as I can tell." When I wrote that a light bulb went off in my head: "The app group entitlement is missing, that's why it works in the simulator and not on the phone!"
I didn't realize that the entitlements have to be specified separately for Debug and Release builds, and I had not specified them for the Release build. Adding that took care of the problem.
I was able to get bundle identifiers for all apps installed on iOS simulator by going to directory
~/Library/Developer/CoreSimulator/Devices/[DeviceID]/data/Containers/Data/Application/
but how do I know which app the ID belongs to? Are there names? Why are all IDs numerical? Are they randomly generated and different on each sim?
I don't know why it is random number. Why apple use this kind of mechanism, But you can get application bundle identifier by using below step.
Step:1
Goto: ~/Library/Developer/CoreSimulator/Devices/[DeviceID]/data/Containers/Data/Application/
Step:2
Select Any application > Open .com.apple.mobile_container_manager.metadata.plist file.
Step:3
Value for MCMMetadataIdentifier is identifier for your application you can also see in below screenshot.
Short answer: just parse hidden file for bundle id ...
~/Library/Developer/CoreSimulator/Devices/< device id >/data/Containers/Data/Application/< app id >/.com.apple.mobile_container_manager.metadata.plist
Why are all IDs numerical? Are they randomly generated and different on each sim?
I believe they’re different on every device, and that the idea is to make it more difficult for malware to figure out whether and where a given app is on the device.
I'm facing some problems with iOS 11. We use App Groups to share some information between some of our apps, but some clients after updated their iPhone to iOS 11+ the apps stoped accessing the information in the App Groups. It always worked.
I'm getting following error:
Couldn't read values in CFPrefsPlistSource<0x1c010b5b0> (Domain: group.com.****, User: kCFPreferencesAnyUser, ByHost: Yes, Container: (null), Contents Need Refresh: Yes): Using kCFPreferencesAnyUser with a container is only allowed for System Containers, detaching from cfprefsd
Anyone has any idea of what can be causing this? Some clients after delete all apps and install again resolved the problem, but some said that it didn't resolved (I don't know if they really deleted all of our apps).
There is some way to recycle or clean the App Groups?
From watch OS 2 we are not able to access app groups so if you want to get any info from keychain e.g login info or some thing, you can use watch connectivity framework. When I tried to access some information from userdefault which worked fine in watchOS1 it shows me the same error after upgrading watchOS . For how work with watch connectivity please see this link. Here everything is explained.
https://kristina.io/watchos-2-how-to-communicate-between-devices-using-watch-connectivity/
In my case error was caused by the fact, that I was trying to create plist file named "settings.plist" inside of the Shared Container the iOS provides us for access via AppGroup.
Seems like it prevents us to create files with names similar to os & core functionality.
Changing the filename, for example "07087_settings" – removes the error, changing back to "settings" – throws error again.
I'm having trouble creating a dedication AppId to my watch extension.
So far my app and corresponding watch app worked perfectly. I had my App ID configured using a bundle id similar to the following format: xx.yyyyy.appName, and the watchkit app & extension were using a wildcard appId with the relevant (and suggested) bundle id of xx.yyyyy.appName.watchkitextension and xx.yyyyy.appName.watchkitapp and everything was great.
I found out I need to change the current behaviour of my apple watch app to share some data with the parent app, and in order to do it I had to enable the App Groups capabilities, where I found I'm not able to do so for the watchkitextension (apparently App Group capabilities required Explicit App ID rather then wildcard App ID).
Realising I don't have a dedicated App ID I went to the member centre and tried to make one unsuccessfully. Following Apple's guidelines I'm trying to create the App ID with the same prefix of xx.yyyyy.appName following .watchkitextension.
This results in the following error message:
An App ID with Identifier 'xx.yyyyy.appName.watchkitextension' is not available. Please enter a different string.
No matter what string I input I get the same error. I made sure I don't have other AppId with similar bundleId associated with it. I even deleted the wildcard App ID to make sure the asterisk (*) in the last digit in the Bundle ID field of it isn't confusing things. No luck -> it became even worst. I can't recreate the wildcard App ID I had before (getting the same error)
UPDATE:
I found out changing the first part of the string (the xx part) to something different allows me to create the AppID - but unfortunately it doesn't solve my problem as I need it to have an identical prefix for the bundle id of the watch extension. I thought maybe this info will be helpful to whoever try to assist.
UPDATE2
I've read the following stackoverflow posts, one, two, three and many others. No luck :(
I'm feeling a bit lost here, any help would be much appreciated!
For example you have app with identifier 'xx.yyyyy.appName'
Watch App:
Your Watch App must be prefixed with the identifier ( 'xx.yyyyy.appName.watchkit')
WKCompanionAppBundleIdentifier - 'xx.yyyyy.appName'
Watchkit Extension
Watchkit Extension must be prefixed with the identifier ('xx.yyyyy.appName.watchkit.extension')
The WKAppBundleIdentifier identifier must match with the WatchKit app bundle identifier ( 'xx.yyyyy.appName.watchkit')
I want to have two version of the same IOS app to stay in the same time in the same device, one for testing and the other for production.
The app is built using phonegap build, so what I have done is
using two different bundle id specified in build.xml (edit: config.xml), so that one is dk.xxxDev.mobile, and the other one is dk.xxx.mobile
having two different apps in the apple developer page, so now I still have the previous one for dk.xxx.mobile and the new one dk.xxxDev.mobile
building using two different provisioning file, one for each app (one is using a developer profile, while the other is using an ad hoc certificate, but i guess we don't care about it)
Still, every time I deploy using itunes or testflightapp, one app overwrites the other one! What am I doing wrong?
edit: I Also changed
- the tag "name" in the build.xml (so that testflightapp can distinguish them )
- I'm using different filnames when I add the app to iTunes
Can you check if the 2 versions of the app generate are using the same IPA file name?
The file naming convention for the Mpbile Apps is as follows:
app_name.version.IPA file
iTunes in the Mac or in the PC store the mobile apps in IPA format and if they are using the same name, installing one will override the other. This is a valid question for Apple Support and this is something that a future version of iTunes may fix.
I was doing something different from what I wrote, I was probably using the same certificate for both versions.
So doing exactly what I wrote, it is supposed to work.
You need to change bundle identifier of one of the apps
Select Project in Xcode, then select target and in general tab you will see bundle identifier string.
e.g. com.YourCompane.AppName change "AppName"