Re: Application Crashing Under Mavericks, but not Yosemite (Entitlements Issue?)
Re: Application Crashing Under Mavericks, but not Yosemite (Entitlements Issue?)
- Subject: Re: Application Crashing Under Mavericks, but not Yosemite (Entitlements Issue?)
- From: Jack Brindle <email@hidden>
- Date: Wed, 31 Dec 2014 17:50:34 -0800
You might want to extend that. The header file indicates that containsString: _only_ is available in OS X starting with 10.10 and iOS starting with 8.0. I would expect this to crash, or at least behave very poorly, under any prior OS since the call simply doesn’t exist there.
Interesting that the only place it appears to be documented by Apple is in the header file. It is widely “documented” at various web sites, but using any call based on that is definitely rolling the dice. The central rule is that if you are releasing code for others to run, be sure to use calls that Apple documents to be available for the earliest targeted OS.
I’d replace it with a more suitable call, which appears to be rangeOfString:options: The header file indicates it should be called with no options. in fact you probably should read the NSString header file info for that call. It is somewhat interesting.
- Jack Brindle
> On Dec 29, 2014, at 5:06 PM, Roland King <email@hidden> wrote:
>
>
>>
>> I'm currently trying to set up developer tools on my new, fresh Mavericks installation, but there is only one place where containsString: is being called, at least by my code, and its here:
>>
>> - (void)detectDistributionFamily {
>> SBLinuxDistribution family = [SBUSBDevice distributionTypeForISOName:self.fileURL.absoluteString];
>> switch (family) {
>> case SBDistributionUbuntu:
>> [self.distributionSelectorPopup selectItemWithTitle:@"Ubuntu"];
>> break;
>> case SBDistributionDebian:
>> case SBDistributionTails:
>> [self.distributionSelectorPopup selectItemWithTitle:@"Debian"];
>> break;
>> case SBDistributionUnknown:
>> default:
>> [self.distributionSelectorPopup selectItemWithTitle:@"Other"];
>> break;
>> }
>>
>> if ([[[self.fileURL path] lastPathComponent] containsString:@"+mac"]) {
>> [self.isMacVersionCheckBox setState:NSOnState];
>> } else {
>> [self.isMacVersionCheckBox setState:NSOffState];
>> }
>> }
>>
>> There's nothing special about this code; I see no reason why it shouldn't work, but then again, this *is* programming. I'll take a look and investigate some more.
>
> Where does containsString: come from by the way? The (n)ever-useful documentation on my box doesn’t have it, the header file for NSString tells me it does exist in 10.10 or iOS8. Apart from despairing again that documentation doesn’t appear to be driven from the header files, is it possible you have a category somewhere which is now interfering in a nasty way with a new selector?
> _______________________________________________
>
> Cocoa-dev mailing list (email@hidden)
>
> Please do not post admin requests or moderator comments to the list.
> Contact the moderators at cocoa-dev-admins(at)lists.apple.com
>
> Help/Unsubscribe/Update your Subscription:
>
> This email sent to email@hidden
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden