rejected by UIFileSharingEnabled key set to true - ios

I've got rejected my recent update on iPhone app and it says:
"When file sharing is enabled, the entire Documents folder is used for file sharing. Files that that are not intended for user access via the file sharing feature should be stored in another part of your application's bundle. If your application does not require the file sharing feature, the UIFileSharingEnabled key in the Info.plist should not be set to true."
I don't have any data which is not supposed to backup via iTunes. So, in this case, how to make a change or appeal to pass the review?

I was able to pass Apple's review without rejection and still set UIFileSharingEnabled = true.
It was very helpful to see the how to from raywenderlich: http://www.raywenderlich.com/1948/how-integrate-itunes-file-sharing-with-your-ios-app.
The key is making the sharing data simple, I guess.

A similar question is also answered here. This part might be relevant for your situation:
When file sharing is enabled, the entire Documents folder is used for
file sharing. Files that are not intended for user access via the file
sharing feature should be stored in another part of your application's
bundle.
Only store user relevant documents in the /Documents folder. For other non-temporary files, use /Library/Application Support instead (or /Library/Preferences).

I've run into the same issue.
In my case I was able to pass Apple's review by changing following line in Info.plist from
<key>UIFileSharingEnabled</key>
<string>true</string>
to
<key>UIFileSharingEnabled</key>
<true/>

Related

Binary file was removed from activity of iTunesConnect

I'm confused that my iOS binary file was automatically removed from activity of iTunesConnect.
I confirmed that the binary file was uploaded as shown in the image. And I tried twice though..
Is this iTunesConnect bug or Should I fix something in my code?
Does anyone have suggestion?
Adding missing privacy-sensitive key data usage in apps "Info.plist" the problem can be fixed.
Check and add the missing keys in your Info.plist file. Refer the link https://developer.apple.com/library/content/documentation/General/Reference/InfoPlistKeyReference/Articles/CocoaKeys.html for more info.
Some keys might be used by the 3rd party pods included in your application. Find them and include in your Info.plist file.(You can get them easily from App Store email sent to you)
Keys Examples similar to which you will need to add: NSCalendarsUsageDescription,NSContactsUsageDescription, NSLocationWhenInUseUsageDescription, NSPhotoLibraryUsageDescription etc.

Can't upload files on iCloud drive [duplicate]

I'm developing an iCloud-enabled app where users will be able to import and export files via iCloud Drive. When browsing iCloud Drive, either using the UIDocumentPickerViewController (iOS 8) or the Finder (OS X Yosemite), I can see directories created/owned by other iCloud-Drive-enabled apps, such as, Automator, Keynote, or TextEdit.
I want our app to expose its ubiquitous documents directory in iCloud Drive, too, but haven't been able to figure it out yet. Within some of the aforementioned apps' Info.plist files, I've discovered this key:
<key>NSUbiquitousContainers</key>
<dict>
<key>com.apple.TextEdit</key>
<dict>
<key>NSUbiquitousContainerIsDocumentScopePublic</key>
<true/>
<key>NSUbiquitousContainerSupportedFolderLevels</key>
<string>Any</string>
</dict>
</dict>
These keys are also documented here, but I haven't found any other documentation on the broader subject. Edit/Note: Although it does not contain the answer to my questions, the Document Picker Programming Guide is a helpful resource.
I've tried adding the above-mentioned keys/values to our app but didn't see any effect. Things I've noticed/tried:
For 3rd party apps, iCloud containers are constructed this way: iCloud.$(CFBundleIdentifier). I'm not sure why TextEdit only uses the pure bundle identifier, but for our identifier, I've tried both approaches, i.e., with and without the iCloud. prefix. I've also recognised that you need to hard-code the bundle identifier (i.e., don't use iCloud.$(CFBundleIdentifier)) as only the PLIST's values seem to be resolved at build time, but not the keys.
I've added a sub-directory programmatically (to <containerPath>/Documents) so the container is not empty. However, this shouldn't matter as all the other apps' directories were initially empty, too.
Some Apple apps that appear in iCloud Drive do not have these entries in their Info.plist, e.g., Numbers and Pages.
iCloud is set up correctly and I can programmatically look into the ubiquity container using the URL returned by [[NSFileManager defaultManager] URLForUbiquityContainerIdentifier:nil];.
I am logged into an iCloud account where iCloud Drive is enabled. I can see my iCloud Drive content in the UIDocumentPickerViewController.
I use the iOS 8 beta 5 simulator (and Yosemite beta 5 to view the iCloud Drive directory on the Mac) (Edit/Note: This equally applies to beta 6)
This is how my Entitlements file looks like (relevant parts only)
<key>com.apple.developer.icloud-container-identifiers</key>
<array>
<string>iCloud.$(CFBundleIdentifier)</string>
</array>
<key>com.apple.developer.icloud-services</key>
<array>
<string>CloudDocuments</string>
</array>
<key>com.apple.developer.ubiquity-container-identifiers</key>
<array/>
I've set this up using Xcode's UI in the Capabilities section. I don't get why the last key doesn't have an entry, but adding <string>iCloud.$(CFBundleIdentifier)</string> doesn't help. Instead, it makes Xcode complain in the Capabilities UI, so I've removed it. Edit/Note: In Xcode beta 6, this has been fixed, i.e., the ubiquity container identifier needs to be set and Xcode can fix that for you.
Original Questions: So... is it a bug? Does it not work yet? Am I doing it wrong? I couldn't find a known issue in the release notes.
Edit:
Two more things that I've tried:
Adding the (optional) NSUbiquitousContainerName key (+ value) to the container-specific dictionary, as suggested by Erikmitk.
Adding only the NSUbiquitousContainerIsDocumentScopePublic key/value to the PLIST root dictionary rather than the container-specific dictionary, as it's done in one of the WWDC sample apps (look for NewBox).
I was experiencing a similar problem with my application. I was able to make this work by doing the following:
Add the NSUbiquitousContainers setting to my Info.plist file according to documentation here https://developer.apple.com/library/prerelease/ios/documentation/General/Conceptual/ExtensibilityPG/FileProvider.html. Here is the relevant code:
<dict>
<!-- ... other top-level Info.plist settings ... -->
<key>NSUbiquitousContainers</key>
<dict>
<key>iCloud.com.example.MyApp</key>
<dict>
<key>NSUbiquitousContainerIsDocumentScopePublic</key>
<true/>
<key>NSUbiquitousContainerSupportedFolderLevels</key>
<string>Any</string>
<key>NSUbiquitousContainerName</key>
<string>MyApp</string>
</dict>
</dict>
</dict>
Important! I then changed the above NSUbiquitousContainerSupportedFolderLevels string value from Any to One
<key>NSUbiquitousContainerSupportedFolderLevels</key>
<string>One</string>
Next, and last, I had to change CFBundleVersion to a higher version. I also bumped the CFBundleShortVersionString to a new version as well.
Built and ran and after that, the folder with my applications icon appeared properly in iCloud Drive! Hope this helps!
When you edited the Info.plist, maybe you forgot to bump up the bundle version number? This is a requirement as per WWDC session #234.
The catch is to call [[NSFileManager defaultManager] URLForUbiquityContainerIdentifier:nil]; (or with another container identifier if it's not the default one) at least once (not per launch, but presumably per version, or when changing one of the respective PLIST entries) in order to initialize the directory. I reckon this step needs to be combined with an increase of the bundle version number, as suggested in roop's answer.
I notice my question may have been confusing in that respect, as I mentioned being able to look into the documents directory* programmatically using the API in question. However, I removed that code from the app later, maybe before getting the rest of the setup right. I'm not going to write into the documents directory directly, only through the Document Picker. Therefore, there hasn't been any need to get the URL.
If you just need a Document Picker to read/store files from/in iCloud Drive or other apps' document directories, there's no need to call URLForUbiquityContainerIdentifier:. Only if you want your app to have its own ubiquity container (and potentially expose it in iCloud Drive and the Document Picker), the steps mentioned in the original post and the call to URLForUbiquityContainerIdentifier: are necessary.
*When mentioning the documents directory, I'm always referring to the one in the ubiquity container, not the local one.
It seems, changing the CFBundleVersion will let it work.
I think you can try it. I got this from Apple Developer Forums.
Hope this work for you.
After dorking around with this all morning, reading all the posts, making all the changes, the key thing that finally worked for me was, as Yet Another Code Maker stated, changing the bundle ID. I think once it has created a container for a bundle, you can't go back and change the visibility of it to have it appear in Finder. I had tried all the different info.plist values but nothing worked until I changed to a new bundle name and forced the system to create a new one. By the way, I didn't see this noted anywhere but the bundle name, the NSUbiquitousContainer name and the NSUbiquitousContainerName can all be different - which is what I did in my case. After spending so much time on this, I figured I would go ahead and put a simple sample app on GitHub in case anyone is still having problems debugging their iCloud folder appearing in Finder - you can find it here. All the required steps are outlined in the README.
In my case (Xcode 7 and iOS 9), the only thing which made it works, after multiple tries, was just use a new bundle identifier (you don't have to change the cloud container identifier, just be sure to select the container you want to use in the Apple Developer Member Centre and to specify in Xcode a custom container instead of the default).
In fact, that means the first time you run your application, the NSUbiquitousContainers section of the info.plist has to be set up. If you set it afterwards as a second step, it won't work...
Well, it's not documented anywhere but try to add Documents folder in the container and store your files there.
Found this hint in replies in this Apple Developer Forum thread.
The .plist entry on this documentation page has an additional entry:
<key>NSUbiquitousContainerName</key>
<string>MyApp</string>
Maybe the missing name is prohibiting it from showing up.
Couldn't find any documentation, but trial and error, I found that:
[[NSFileManager defaultManager] URLForUbiquityContainerIdentifier:#"com.apple.CloudDocs"];
Gives you the base URL for the drive as seen in the picker. Using this base URL I was able to save files in my app and see it on the iCloud drive within Yosemite.
Edit 14.8.14
I tried your plist settings:
<key>NSUbiquitousContainers</key>
<dict>
<key>iCloud.net.redacted.docTest</key>
<dict>
<key>NSUbiquitousContainerIsDocumentScopePublic</key>
<true/>
<key>NSUbiquitousContainerSupportedFolderLevels</key>
<string>Any</string>
</dict>
</dict>
In my little throwaway test app "docTest" it does indeed expose the empty Documents directory in Yosemite and in the document picker.
Screenshot http://spring-appstudio.com/picker-view.png
Just wanted to emphasize one of the OP's discoveries that fixed it for me:
I've also recognised that you need to hard-code the bundle identifier (i.e., don't use iCloud.$(CFBundleIdentifier)) as only the PLIST's values seem to be resolved at build time, but not the keys.
You need to hard code the bundle id. Also update the version.
(I didn't notice this in the question until I went through all the answers).
Same problem occurred to my OSX app.
It is seemed that NSUbiquitousContainers setting works only in the creation time of the iCloud containers. So I tried with new Apple ID(for preparing clean iCloud environment), it becomes to work.
I know this is an old thread but just in case someone runs into the same issue: Only way for me to get my Container folder to be visible in iCloud Drive (after trying all the above suggestions) was to have my app create a temporary file in the Documents folder. As soon as I did that the Container Folder (and the file I created) showed up on my Mac. If this is really the case that I have to create a file to make this folder visible then this would be a bit annoying because my app is a read only app (only reads files added by the user to the Container Folder). The Container Folder needs to be visible as soon as the app is launched for the first time. I guess I will have to detect the first launch.

Sharing the project, but not the code, with a tester

Please forgive me if I am asking a dumb question, I am fairly new to ios and cocos2d programming. I have developed an app that is almost done. I have an architecture where settings are in a plist file.
I want to share the app with my colleague, who has agreed to test and make changes to the plist if necessary, so that he can see which settings are the best.
What I want to know:
Is there a way to share my app with him (he has a mac and a ipad) so that he only has access to the plist file but won't be able to access the rest of the code? Thank you in advance.
One idea: To put my plist on a server and have a call to download the plist file when the game begins, so he can just change that. Is there a better way ?
Yes, have the app download the plist so he can edit it on the server. When you save the .plist, save it in the documents folder (outside of the bundle). Bundle is read only, and modifying it will destroy the signature, making it so he can't install it, unless the device is jailbroken.
Alternatively, copy the file from the bundle to the documents folder on first run and enable file sharing for the app. Then he can edit the .plist file and update it via iTunes.
The bundle only contains compiled object code, so he will not have access to source code.
You can use testflight or email him the .ipa and he can install via iTunes, or if you have a developer account, you can set him up as a tester through iTunesConnect once you've uploaded your app.
look for iExplorer, that should enable you to up and download resources to/from your iDevice.
You could also create a 'debug mode' (for example accessed by turning the phone upside down or whatever you like). That debug mode can contain controls to manipulate the settings read from the plist and reboot the game. No server involved, just client side manipulation so you can just hand him the binary.

What is the use of entitlements.plist file?

I have some questions regarding entitlement file:
What is the use of entitlements file.
What happens if I don't add it.
What is the difference between myApp.entitlements and entitlements.plist?
The entitlements file defines certain capabilities of your app. Usually, the file is automatically generated by Xcode when you enable a capability for your app.
You only need the file if you enable certain capabilities, e.g. Healthkit integration. If you'd like to use these features, you have to add it. Otherwise, Apple will reject your app.
You can name the file like you want. You can also rename it as long as the build settings point to the correct file name for it.
Entitlements are announcements that “I am gonna use this feature like APPLE PAY” and provision profile will say, “Yes dear you can use Apple Pay Feature”.
Entitlements are part of the code-signed app.
myApp.entitlements is Xcode generated plist when you enable capabilities (e.g push notification) for that particular target.

Making a file created by an application to be shared by iTunes

How to make a file created via an ipad application to be available to iTunes.
And how to make an application support iTunes file sharing could some one give a code snippet for both these
All you have to do is set UIFileSharingEnabled to YES in your info.plist. Once that's set, anything in your app's documents folder will be accessible through iTunes.

Resources