Two classes in my sandboxed application need to export a NSDictionary as a plist file.
On the Capabilities, the Permission/Access setting is read/Write for User selected files. I use XCode 10.11.1 on Mojave, and build for ≥10.12. From several classes that need to export files, two are very similar and manage NSDictionary.
For those two, when the user prompts for save, I open a NSSavePanel to choose the destination filename and directory. I use exactly the same code for my two classes:
NSSavePanel *panel = [NSSavePanel savePanel];
[panel setNameFieldStringValue:newFilename];
panel.extensionHidden = TRUE;
[panel beginWithCompletionHandler:^(NSInteger result) {
if (result == NSFileHandlingPanelOKButton) {
NSURL *saveURL = [panel URL];
NSString *savePath = [saveURL path];
if (![[savePath pathExtension] isEqual:@"plist"]){
savePath = [savePath stringByDeletingPathExtension];
savePath = [savePath stringByAppendingString:@".plist"];
}
[exportDic writeToFile:savePath atomically:YES];
}
}];
What is strange is that saving this ways always works for one class that use this code, whereas it doesn't succeed for the second class, except one non-reproductible time! I got no message on the debugger console, but I can see one in the Console application:
Sandbox: MyApp (xxxx) deny(1) file-write-create my_file_path.plist
I verified everything, reset the sandbox setting, clean build folder, quit/relaunched Xcode, and even rebooted the computer several times. Any idea? Thanks
Post
Replies
Boosts
Views
Activity
Hello, I am testing an inApp purchase for a MacOS application I develop (sandboxed).
I noticed that the price displayed to the user when he/she tries to test the inApp purchase is more expensive then the price tier set with Apple Connect for this inApp. The "purchase" (or restore) process is working perfectly but it always asks 2 euros more than the tier amount, whatever the latter is (tested on french store)? Thanks
On my spreadsheet application, with its own UTI, I wrote a Spotlight importer plugin.
It works well, except that Spotlight group the found files as "Other" and not as "Spreadsheet". My UTI conforms to public.spreadsheet. Any idea?
Is there a special kMDxxx key/value to set for that in the importer?(see: https://developer.apple.com/library/archive/documentation/CoreServices/Reference/MetadataAttributesRef/Reference/CommonAttrs.html
)
Thanks!
I recently updated my sandboxed application to the MacOS 12 target. Among deprecation, there is the allowedFileTypes method for NSOpenPanel/NSSavePanel, replaced with allowedContentTypes. I updated my document opening and importing methods to reflect this change. For example, to import a CSV or JSON file, I coded:
myPanel.allowedContentTypes = [NSArray arrayWithObjects:UTTypeJSON, UTTypeCommaSeparatedText, UTTypeTabSeparatedText, [UTType typeWithIdentifier: @"org.openxmlformats.spreadsheetml.sheet"], nil] ;
All these UTTypes are described in the "Imported Type UTIs" section of the app's Info.plist.
Unfortunately, it is impossible to select any of Json, Csv or Xlsx file in the NSOpenPanel since I made these changes to be in line with MacOS12 requirements. Worse, I cannot open my own file format with its own UTI (described in Info.plist too)! The only way to open/import is to set myPanel.allowOtherFileTypes to TRUE, and to remove any code referring to allowedContentTypes.
What is quite strange is that exporting works correctly after updating. My spotlight plugin works also (for my file format)… Something I missed? Help welcome as my app became useless since I made these changes, and I use it every day for my work (and improving it before launching it on the Appstore)
Hello. My MacOS application has been regularly notarized for 12 weeks to allow people test the beta version, without any problem. Now the application is ready for Appstore submission.
Unfortunately, the uploading process ends with an error: "Bad CFBundleExecutable. Cannot find executable file that matches the value of CFBundleExecutable in the nested bundle ApplicationHelp [fr.application.pkg/Payload/Application.app/Contents/Resources/ApplicationHelp.help] property list file."
In the ApplicationHelp target, no CFBundleExecutable key is set. But if I read the Info.plist of the built help bundle, I can see that such key has been added during the build process. What can explain the presence of this key that seems to create the error when trying to upload the application package to the Appstore?
The only keys set in the help bundle info.plist are:
HPDBookAccessPath
HPDBookIndexPath
HPDBookTitle
HPDBookType
CFBundleDevelopmentRegion
CFBundleIdentifier
CFBundleSignature
CFBundleVersion
CFBundlePackageType
CFBundleInfoDictionaryVersion
Using Xcode 15.2 on Sonoma, application built for MacOS ≥ 12 (Apple Silicon only)
Thanks