Post

Replies

Boosts

Views

Activity

UIFont monospacedDigitSystemFont doesn't work
Dear Experts, Does monospacedDigitSystemFont work for others? It is supposed to be a font where digits are monospaced, but other characters aren't. This is especially useful for things like counter widgets, where you don't want the total length of the string to fluctuate as it updates. When I try to use it I get the same results as for the regular system font, i.e. digit 1 is narrower than the others. [UIFont monospacedSystemFont...] does work correctly.
2
0
1.2k
Sep ’22
UIImage and CGImage have different aspect ratio for SFSymbols
Dear Experts, I create a UIImage for an SFSymbol using [UIImage systemImageNamed], get its CGImage, and look at the sizes of each: UIImageConfiguration* config = [UIImageSymbolConfiguration configurationWithPointSize: 64 weight: UIImageSymbolWeightLight scale: UIImageScaleMedium]; UIImage* img = [UIImage systemImageNamed: @"chevron.compact.down" withConfiguration: config]; CGImageRef c = [img CGImage]; printf("UIImage size %f x %f, CGImage size %f x %f\n", img.size.width, img.size.height, CGImageGetWidth(c), CGImageGetHeight(c)); (Consider that pseudo-code, it's not an exact copy-paste.) Results: UIImage is 70.3333 x 25.6667 and CGImage is 163 x 43. So the aspect ratios (W/H) are 2.74 and 3.79 respectively. That can't be right! I don't expect the UIImage and the CGImage dimensions to be the same, because of the UIImage's scale (which is 3 in this case). But that should be the same for both dimensions. The effect is most pronounced with symbols that have an aspect ratio far from 1, e.g. recordingtape, ellipsis, and this chevron.compact.down. I believe that the CGImage aspect ratios are the correct ones. What is going on here?
5
0
1.8k
Oct ’22
Inkscape for custom SF Symbols
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!
Topic: Design SubTopic: General Tags:
0
2
1.1k
Oct ’22
SF Symbols category in Feedback Assistant
I'm considering sending some suggestions for additional symbols, but I can't find a suitable category in Feedback Assistant. Am I missing something? What category would you use? Should I first file a bug against Feedback Assistant asking for a new category??
Topic: Design SubTopic: General Tags:
2
0
854
Oct ’22
NSFileCoordinator/Presenter and background location apps
Dear Experts, It is necessary to remove NSFilePresenters when an app goes to the background and re-add them when it returns to the foreground - if you don't do so, the app will be terminated. But what about an app that has the location background mode enabled? Specifically, I have an app that records your location, in the foreground or background, and writes this data to a file. It does writes to the file inside a coordinated write block, and monitors for writes from other processes. This works fine in the foreground. I'd really like to also get notifications of concurrent changes to the file while the app is in the background, but this doesn't seem to be possible. (It's actually more likely that a file will be modified by another app while I'm in the background - consider switching to the Files app, and then back again.) Any suggestions?
6
0
1k
Oct ’22
Disable sprintf deprecation warning
Dear Experts, Xcode 14 is giving me a new deprecation warning about sprintf. I understand why this is here (*) but I need to suppress it in some cases. I don't want to disable it everywhere (or lose other deprecation warnings). Specifically, I #include some Boost headers which use it in inline functions. I know that I can use #pragma to disable it, but I don't want to modify the Boost headers. Adding #pragma everywhere that I #include a Boost header is also unappealing. What other options do I have? (*) I'm not enthusiastic about the suggesting in the warning to use snprintf instead; snprintf leaves the destination unterminated on overflow, which can be just as bad as the sprintf behaviour.
3
3
5.4k
Nov ’22
Membership renewal payment card info confusion
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.
0
0
2.5k
Nov ’22
Different Files app behaviour on iPhone vs iPad
Dear Experts, I am confused by what seems to be a difference in behaviour of the Files app on an iPhone compared to an iPad. On the iPad, I seem to be able to view my app's Documents/ folder; on the iPhone, I can't. On the other hand I can access the app's iCloud documents on both devices. Is this the expected behaviour? If so, what is the rationale? Thanks, Phil.
1
0
768
Feb ’23
file: XML and XSLT in WKWebView
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!
0
0
798
Feb ’23
Can a WKWebView somehow display SF Symbols?
Does anyone know if it’s possible for a WKWebView showing a web page in the app bundle - a help screen in my case - to show SF Symbols, by name? I’d like the help page to include some of the symbols that I use for buttons elsewhere in the app. Can I do this without having to make PNGs of the symbols? Thanks.
1
0
1.2k
Feb ’23
Can't simulator run same executable as device, now they are both ARM?
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?
0
0
659
Mar ’23
NSFilePresenter gets presentedItemDidChange every second when iOS app runs on Mac
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?
0
0
519
Mar ’23
Screenshots for 5.5" iPhone
I have a new app which requires iOS 16. App Store Connect wants me to upload screenshots of various sizes, mostly optional - but 5.5" with square corners and physical home button is required. As I understand it, the only device that can run iOS 16 and that has a 5.5" screen is the iPhone 8 plus. I have an iPhone 6 plus, which has the right dimensions, but it doesn't run iOS 16. The newer phones with physical home buttons (i.e. the SE 2 and 3) have 4.7" screens. Apple won't sell me anything older than an iPhone 12, even refurbished. Do I need to buy an iPhone 8 plus from eBay? Is there something that I can do to prevent the app from running on this device, and thereby make this screenshot size not required?
4
1
4.6k
Apr ’23
Memory-mapped files in Allocations instrument
Dear Experts, Where do memory-mapped files appear in the Allocations instrument, if at all? In the screenshot below, the green "all anonymous VM" graph is almost completely explained by the purple "IO Accelerator" graph (GPU buffers, textures etc) - but there are periods at the start of each cycle (such as at the cursor position) where there is some other contribution. I have not been able to find this in the other more-specific graphs. Any ideas anyone? I have been trying to make this app better behaved memory-wise and have made a lot of progress, in particular by removing periods when two large memory allocations co-exist, and by breaking work up into chunks. It now bothers me that there is 150 MB of "anonymous VM" that I cannot explain!
1
0
1.2k
May ’23