Post

Replies

Boosts

Views

Activity

XCTest resources aren't being copied into place correctly
So I have a project with an Objective-C framework which has unit tests. One of the unit tests has a file 'sample.emlx' in its 'Resources' folder, which has its target membership set to the tests target. I expect this file to be copied into the correct place, such that I can find it (in the 'setup') method with: NSBundle *bundle = [NSBundle bundleForClass:[self class]]; NSString *path = [bundle pathForResource:@"sample" ofType:@"emlx"]; NSData *content = [NSData dataWithContentsOfFile:path]; NSString *entire = [NSString stringWithUTF8String:content.bytes]; _sample = [entire componentsSeparatedByString:@"\n"]; NSLog(@"sample lines: %d", (int)_sample.count); The idea is to make an array where I can pull various subsections of lines out to test various parts of the code. This works every time, if I set a breakpoint at the "create the NSBundle" line, and single-step through the code after right-clicking on the specific test method I want to run It never works if I just right-click on the specific test method I want to run and allow it to run freely. I will always see "sample lines: 0" This is with the latest public Xcode, I haven't tried any beta variant.
0
0
45
3w
M3 Max won't update past 15.4.1
So I have an M3 Max MBP which I was planning on taking out to use while my son had his 4-hours-long archery class, but I've been using the Studio (running Tahoe) for development, and the version of Xcode running on there is too new for the version running on the MBP. So I try to update the MBP, but Settings thinks it's up to date: This is an M3 Max... so that seems ... unlikely. I've tried rebooting the thing, I've tried clicking any number of times on the 'check for updates' button, but no joy. Anyone got any pointers ?
2
0
150
2w
How does one get the locale-specific character set encoding on a Cocoa App
If (in terminal) I type 'env', I'll see a line that looks like: LANG=en_GB.UTF-8 And I can parse that to get the 2-char 'en' locale-code, the sub-domain 'GB' and the character-set encoding of UTF-8. All well and good. However in a Cocoa app, I can't seem to find the equivalent for the "UTF-8" part. This is a cross-platform app, but at this point I'll go with any solution... I've tried: NSLocale *loc = NSLocale.currentLocale; NSString *lang = loc.localeIdentifier; setlocale(LC_ALL, NULL); char *text = nl_langinfo(CODESET); if (text) NSString *charset = [NSString stringWithUTF8String:text]; NSLog(@"lang:%@\nchar:%@\n",lang, charset); which displays: lang:en-GB char:US-ASCII Also tried: // Search for locale info by preferred environment variable NSProcessInfo *pi = NSProcessInfo.processInfo; NSDictionary<NSString *,NSString *> *env = pi.environment; NSString *spec = env[@"LC_ALL"]; if (spec == nil) spec = env[@"LC_CTYPE"]; if (spec == nil) spec = env[@"LANG"]; NSLog(@"spec:%@\n", spec); which displays: spec:(null) Also tried: CFStringEncoding sys = CFStringGetSystemEncoding(); CFStringRef enc = CFStringConvertEncodingToIANACharSetName(sys); NSString *nsEnc = (__bridge NSString *)enc; NSLog(@"iana:%@", nsEnc); enc = CFStringGetNameOfEncoding(sys); nsEnc = (__bridge NSString *)enc; NSLog(@"name:%@", nsEnc); CFStringEncoding compat = CFStringGetMostCompatibleMacStringEncoding(sys); enc = CFStringGetNameOfEncoding(compat); nsEnc = (__bridge NSString *)enc; NSLog(@"name:%@", nsEnc); which displays: iana:macintosh name:Western (Mac OS Roman) name:Western (Mac OS Roman) Any ideas ?
3
0
79
3w
Limit access for a file/folder to a given application
So I'm aware that Apple can designate a folder as a "data vault", and access to that folder is limited to applications that have a specific entitlement. I was wondering if there was an equivalent (or the same, I'm not fussy :) feature available to third parties, even if only during the app-store submission ? To avoid the X-Y problem, what I want to do is have a launch agent with access to a SQLite database, and I want only that launch agent to have access. Any reads of the database will have to be done through an XPC call from the main user-facing application. I want to store private data into that database, and I don't want there to be any way for any other application to read it. If there's a way to do that without data-vaults I'm all ears :) I'm not sure if this is really the right place, perhaps the core-os forum would be better, but since the Apple solution is gate-kept by entitlements, I thought I'd start here :)
5
0
155
2w