I have a file on my Mac of a slightly unusual type. Let's say it's an "XYZ" file. Maybe I downloaded it from somewhere. I don't have any programs on my Mac that know about XYZ files, so if I view it in Finder is is shown with a plain icon and a generic description e.g. "Document". If I check its type, it seems that macOS has allocated it a "dyn.*" UTI:
% mdls -name kMDItemContentType ~/foo.xyz
kMDItemContentType = "dyn.ah62d4rv4ge81u8p4"
I do have an app on my iPad that knows about XYZ files. The app has a UTImportedTypeDeclarations entry for .xyz in its Info.plist. I transfer the file to my iPad using AirDrop. Annoyingly, the iPad does not offer to open the file with the appropriate app.
It seems to me that the iPad has blindly trusted the dyn.* UTI that macOS allocated for the file, and which presumably has been sent by AirDrop. It has not used the filename extension mapping from its app's Info.plist to determine that the file is an XYZ file. That may be considered a bug in iOS but that's not my question...
My question is: is there anything that I can do on my Mac to tell it that this file foo.xyz is of type UTI com.example.xyz ?
I was expecting to find either an md... command to modify the metadata, including the UTI, for a file, or some way to do this by setting an extended attribute. I have not yet found either. Any ideas anyone?
Selecting any option will automatically load the page
Post
Replies
Boosts
Views
Activity
Dear Experts,
We are required to remove our NSFilePresenters from the NSFileCoordinator when the app goes to the background and re-add them when it returns to the foreground.
Does this mean that when we foreground, we need to manually check if our files have been modified, deleted, or moved in the meantime? Or is there some mechanism in NSFilePresenter/NSFileCoordinator that will report any such changes to us?
Detecting that a file has been modified or deleted is not difficult, but I don't think it's possible to detect that it has moved. Changes to directories are also difficult.
Any advice? What does UIDocument do in this case?
Dear Experts,
Should I use NSFileCoordinator coordinateWritingItemAtURL: around a call to NSFileManager trashItemAtURL: ?
What options should I pass - NSFileCoordinatorWritingForDeleting, or ...ForMoving, or something else?
I've attempted various combinations. If I don't use the NSFileCoordinator, then the change is not reflected in the Files app (open alongside my test app in iPad split screen mode). All attempts using NSFileCoordinator result in a deadlock inside trashItemAtURL - it is stuck waiting for a semaphore.
I do have a FilePresenter for this file, but I am passing it to the NSFileCoordinator's init so that should not lead to deadlock.
I believe I am doing everything on the main thread. The files are local, in the app's Documents directory.
Any ideas anyone?
Dear All,
Does anyone have any suggestions for an iPad text editor app that is well-behaved with respect to NSFileCoordinator / NSFilePresenter / UIDocument etc.?
Specifically, I'd like something that I can run in iPad split screen mode alongside my test app. I'd like to be able to make changes to files using the text editor and see my test app pick them up, and vice-versa.
I am currently trying an app called "Quick Text" which mostly works but it doesn't seem to pick up changes that I make in my test app unless I close and re-open the file at its end. I'm also soon going to reach its limit of "10 edits per week"!
I have a couple of others to try, but maybe someone here has a suggestion?
Dear Experts,
NSCoordinatedFile's coordinatedRead and coordinatedWrite methods supply a possibly-modified path to the accessor block. (I think it is only modified if there are concurrent accesses, so none of this is easy to test.)
If I enumerate the contents of a directory inside a coordinatedRead on the directory, the paths that I get for the directory entries will include this possibly-modified parent path. (Unless maybe NSFileManager's enumeration methods have some magic to avoid that.)
Is it OK for me to keep these "special" pathnames beyond the end of the coordinatedRead?
If not, perhaps I need to get only the leafname from the directory enumeration and append that to the original directory path.
Thoughts anyone?
Dear Experts,
Is there a way to limit an NSMetadataQuery to one iCloud container, in an app with more than one?
It seems to me that setting the scope to NSMetadataQueryUbiquitousDocumentsScope will probably return either the contents of the first (default) container, or all containers
Is there something I can put in the predicate? Maybe I have to try to match URLs that start-with the container's own URL?
I believe that if I rename a file, I'm supposed to do that inside a coordinated write on the parent directory - right?
So say I have a file /path/to/folder/f1 and I want to rename it (in the same directory) as /path/to/folder/f2.
I do a coordinated write (with the forMoving option) on the directory /path/to/folder. That passes me a possibly different path to the directory, right? Say I get /path/to/different.
Question: what rename should I actually do? Do I need to construct from and to paths based on the different path that is passed to the accessor? I.e. do I
rename from /path/to/folder/f1 to /path/to/folder/f2
or rename from /path/to/different/f1 to /path/to/different/f2
or some other combination?
Do NSFileManager's renaming methods do anything special in this regard? Can I use e.g. std::filesystem::rename()?
I am interested in both local documents that are visible e.g. in the Files app, and iCloud Drive documents, if that makes any difference.
Thanks!
Has anyone had any luck using Inkscape to edit custom SF Symbols?
It seems to work OK except that it doesn't understand the required layer structure. The layers are SVG group elements, which Inkscape doesn't seem to treat as layers. I think it must need some additional attributes to distinguish layers from other groups, or something.
Edited to add: specifically it seems to need the attribute inkscape:groupmode="layer" on the element. I'm going to try adding this manually to the template and see what happens!
I recently received an auto-email from Apple:
We noticed that there's no billing information associated with your Apple ID, so your Apple Developer Program membership cannot be automatically renewed. To renew your membership, update your Apple ID with a valid credit/debit card any time before your membership is scheduled to renew.
Update now > https://appleid.apple.com/
(This was not entirely unexpected; I changed bank account a few months ago.)
But when I visited appleid.apple.com, I found that I did have a card registered there. So I contacted support and they told me that I should actually add my card details at www dot apple dot com/shop/account/home (or my national variant of that) (*) - and indeed that website has its own section for registering payment cards, which was empty.
So I have filed a bug saying that the auto email has the wrong link in it (FB11823024). I also asked support why there were two different places where card details are recorded, and got this reply:
Apple Store payment information is used to pay what you are buying on
the App Store.
Apple ID payment is associate with your Apple Connect payment method
information.
Which is not very clear to me. What is "Apple Connect"?
Anyway.... everyone beware. If you get that email, and you think that you have definitely registered a payment card, and you follow the link and it confirms that you have registered a payment card .... don't stop worrying, your renewal may still fail!
(*) Yeah, this forum won't let me mention Apple's own websites without obfuscation.
Topic:
App Store Distribution & Marketing
SubTopic:
App Store Connect
Tags:
App Store Connect
Developer Program
Has anyone ever tried to use XML & XSLT in WKWebView, with the files included in the app bundle?
I.e. example.xml:
<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet type="text/xsl" href="transform.xslt"?>
<page>
</page>
transform.xslt:
<xsl:transform
version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
>
<xsl:template match="page">
<html>
<body>
<p>Hello World</p>
</body>
</html>
</xsl:template>
</xsl:transform>
When I attempt to load that as file:///path/to/bundle/example.xml, I get a blank page (and nothing in the console).
Various questions:
I know that generally web console output inside apps doesn't appear in the logs, and there are various suggestions about injecting user scripts to fetch them by replacing e.g. console.log. But does that only fetch errors generated by Javascript, or does it also fetch other error messages? Should I be able to attach to my WKWebView's console from Safari on my Mac, over USB?
If I try to view the same file using a file: URL in Safari on my Mac, I discover that security policy prevents a file: XML document from using a file: XSLT even if they are in the same directory; it considers all file: URLs to have different origins. I don't see that error with the WKWebView, hence question (1).
Is there anything that I can do with WKWebView to permit access from a file: XML document to a file: XSLT document in the same directory, within the app bundle? I have tried using loadURL: allowingReadAccessToURL:, and that doesn't seem to work. I'm also aware of the WKSecurityOrigin type, and I wonder if I can use that to persuade WKWebView that the XML and XSLT are "same origin". Does this require that I implement a "content blocker"? Can a content blocker ever relax restrictions, rather than tightening them?
Thanks for any suggestions!
Dear Experts,
Now that Macs have ARM processors - and in some cases, the exact same ARM processors as some iOS devices - why can't XCode's simulators run the same executables as the devices?
Specifically, I can build my iPad app and run it on my iPad, and I can then run the exact-same app on my Mac, using the "My Mac - designed for iPad" target. So in that case, the Mac OS does whatever mapping is needed to run the iOS executable. But if I want to run on the Mac simulating a particular iPad device, I need to build a different executable. (This obviously made sense when the Mac was x86 and the iPad was ARM.)
It's time consuming for me to create simulator builds mainly because of the third-party (i.e. mostly open-source) libraries that I link with, which need to be re-built for the simulator; often, cross-compiling these things is difficult enough to do once, let alone twice.
My only use for the simulator is to test on devices with different screen sizes than the physical devices that I have. Running in "designed for iPad" mode and resizing the window is almost sufficient, but it doesn't let me see the effect of notch / round-corner safe area insets, and the display scale may be different.
Thoughts anyone?
When I run my iOS app on my Mac using "designed for iPad", it seems to get presentedItemDidChange for files it is displaying once every second.
There don't seem to be any changes to the files in the filesystem. Is there any way to debug what is causing the app to receive the presentedItemDidChange callback?
Documentation for the App Store Connect API is poor, especially in comparison to the good documentation for the now-defunct XML-based "transporter" API. In the hope that it will be useful to others trying to do this in the future, here is how I was able to do a bulk update of my in-app purchases' prices using the API.
Step 1: get the IDs for the IAPs, if you don't already know them:
GET v1/apps/$app/inAppPurchasesV2
If you have a lot of IAPs, follow any links/next URL to get subsequent pages.
The ids are in data/id .
Step 2: get the current prices, if you don't already know them.
I believe you need to do a separate request for each IAP (right?).
GET v1/inAppPurchasePriceSchedules/$iap/manualPrices?include=inAppPurchasePricePoint,territory
The price and currency are in included/attributes/customerPrice and included/attributes/currency (I generally only have one "manual" price).
Step 3: look up the available price points:
GET v2/inAppPurchases/$iap/pricePoints?filter[territory]=$territory
The prices and IDs are in data/attributes/customerPrice and data/id.
Note this query takes the specific IAP ID. I don't know why. Are the price points specific to the IAPs? Can I reuse a price point ID that I've looked up for one IAP with another IAP for the same app?
Step 4: choose your new prices.
Step 5: Submit the new prices:
POST v1/inAppPurchasePriceSchedules
{
"data" : {
"relationships" : {
"baseTerritory" : {
"data" : {
"id" : "$territory",
"type" : "territories"
}
},
"inAppPurchase" : {
"data" : {
"id" : "$iap",
"type" : "inAppPurchases"
}
},
"manualPrices" : {
"data" : [
{
"id" : "$random_id",
"type" : "inAppPurchasePrices"
}
]
}
},
"type" : "inAppPurchasePriceSchedules"
},
"included" : [
{
"attributes" : {
"startDate" : null,
"endDate" : null
},
"id" : "$random_id",
"relationships" : {
"inAppPurchasePricePoint" : {
"data" : {
"id" : "$price_point_id",
"type" : "inAppPurchasePricePoints"
}
},
"inAppPurchaseV2" : {
"data" : {
"id" : "$iap",
"type" : "inAppPurchases"
}
}
},
"type" : "inAppPurchasePrices"
}
]
}
In that, $iap is the IAP ID from step 1, $territory is probably a three-letter string like GBR, $random_id is a random identifier that you generate (using the same value in the two places) (I'm not sure what the scope of this is; do I have to check that I don't accidentally send the same value in the future, or does it only exist while this submission is processed?), and $price_point_id is the ID for the price point from step 3.
I believe it is necessary to send a separate submission for each IAP (right?)
That example makes the change immediately (start and end dates are both null). Note that if you want to schedule a future change, you need to include both the current period and price and the future period and price in the submission.
I would like to thank @Efun whose posts in this thread: https://developer.apple.com/forums/thread/727159 helped a lot with understanding this.
Topic:
App Store Distribution & Marketing
SubTopic:
App Store Connect API
Tags:
App Store Connect API
Dear All,
I've just received an email from a user of my paid app who says he is no longer able to use it on his work phone. He works for a US government agency which I'll abbreviate to GOV below. Apparently they have started using Microsoft Intune for device management and as a result they need the following work-around:
This app is not free to download, so it cannot be added to Intune app catalog through this tool. Reach out to the app developer and explain that GOV uses Apple Business Manager (ABM) and MDM for delivering managed apps to devices. Payment through ABM is not supported by GOV, so the app developer will need to provide a version of the app that's free to download but take payment outside of the Apple ID payment process. GOV's Custom App Store can be access by developers by advertising their app to Organization ID 12345678.
I don't know much about MDM, ABM and Intune, and I would more or less consider this a scam except that I am confident that the person who has sent it really does work for this government agency and does use my app on his personal device.
Is there any possibility that what they are asking for is legitimate?
I suspect that the crucial part is: "Payment through ABM is not supported by GOV", i.e. fundamentally ABM/MDM/Intune can support paid apps, but the financial people at GOV AGENCY have chosen not to support that.
Has anyone else experienced anything like this?
Topic:
App Store Distribution & Marketing
SubTopic:
General
Tags:
App Store
Apple Business Manager
Device Management
Has anyone paid a graphics designer to produce custom SF Symbols for them? Would you care to share your experiences?
I paid for some custom graphics a decade ago; the results were OK but not amazing. I forget how I found that guy. No doubt everything has changed since then.