Re: Application Crashing Under Mavericks, but not Yosemite (Entitlements Issue?)

2015-01-01 Thread Uli Kusterer
On 01 Jan 2015, at 16:15, SevenBits  wrote:
> Uli: is it possible to create a category which defines a method called 
> containsString:, and only have it activate on 10.9 or lower and use the new 
> Apple method on 10.10 and above?

 In theory, you could add code on 10.8 and earlier that registers the IMP of 
sb_containsString: for the selector containsString: as well, using the ObjC 
runtime API, or put the category in a loadable bundle and not load that on 
10.10 and later, but I don’t recommend it as a general approach.

 It’s just too easy to run into conflicts with someone else’s category. Also, 
sometimes Apple privately implement a selector with different parameter types 
in an older OS version, then change its parameters but not the name before they 
make it public, and you’d end up failing to replace it (or worse, replacing it 
successfully and breaking the OS on the way).

 But yeah, unless you set the min *and* max OS version to <= 10.9, you prolly 
won’t get an error message when you use this selector.

Cheers,
-- Uli Kusterer
“The Witnesses of TeachText are everywhere...”
http://zathras.de


___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

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:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Re: Application Crashing Under Mavericks, but not Yosemite (Entitlements Issue?)

2015-01-01 Thread Roland King

> On 1 Jan 2015, at 23:00, Uli Kusterer  wrote:
> 
> On 01 Jan 2015, at 02:50, Jack Brindle  wrote:
>> 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.
> 
> A good workaround is probably to create your own equivalent call with an 
> identical signature in a category and just replace all calls to 
> containsString with that:
> 
> @implementation NSString (SBContainsStringBackwardsCompat)
> 
> -(BOOL) sb_containsString: (NSString*)inString
> {
>   return [self rangeOfString: inString options: 0].location != NSNotFound;
> }
> 
> @end
> 

I suspect this thread died at the point the OP realised they used a 10.10 
method in the latest changes to the code which broke pre-10.10 compatibility, 
it had nothing to do with entitlements at all and backed that change out and 
replaced it with something pre 10.10 compatible. Would have been nice to have 
seen a follow up so the thread can help other people searching. 

SevenBits, people pitched in to help you here, what was the final resolution or 
do you still have an issue? 


___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

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:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Re: Application Crashing Under Mavericks, but not Yosemite (Entitlements Issue?)

2015-01-01 Thread Uli Kusterer
On 01 Jan 2015, at 02:50, Jack Brindle  wrote:
> 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.

 A good workaround is probably to create your own equivalent call with an 
identical signature in a category and just replace all calls to containsString 
with that:

@implementation NSString (SBContainsStringBackwardsCompat)

-(BOOL) sb_containsString: (NSString*)inString
{
return [self rangeOfString: inString options: 0].location != NSNotFound;
}

@end

(Warning: code written in mail, never compiled) Then, when your baseline rises 
to 10.10, you can just do a search-and-replace of sb_containsString: to 
containsString:.

Cheers,
-- Uli Kusterer
“The Witnesses of TeachText are everywhere...”
http://zathras.de


___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

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:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Re: Application Crashing Under Mavericks, but not Yosemite (Entitlements Issue?)

2014-12-31 Thread Jack Brindle
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  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 (Cocoa-dev@lists.apple.com)
> 
> 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:
> https://lists.apple.com/mailman/options/cocoa-dev/jackbrindle%40me.com
> 
> This email sent to jackbrin...@me.com


___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

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:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Re: Application Crashing Under Mavericks, but not Yosemite (Entitlements Issue?)

2014-12-29 Thread Roland King

> 
> 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 (Cocoa-dev@lists.apple.com)

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:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Re: Application Crashing Under Mavericks, but not Yosemite (Entitlements Issue?)

2014-12-29 Thread Quincey Morris
On Dec 29, 2014, at 16:27 , SevenBits  wrote:
> 
> The thing is, I am not using iCloud and that entitlement isn't even present
> in my entitlements file. Those messages are from just opening the
> NSOpenPanel, and doing anything else; clearly, Powerbox is flipping out.

AFAIK, NSOpenPanel originally (that is, in 10.8.6 or so) did *not* use Powerbox 
in non-sandboxed apps. Whether that has changed since then, I don’t know.

> Here are the messages that appear to be
> relevant:
> 
> 12/29/14 7:09:19.969 PM Mac Linux USB Loader[257]: view service marshal for
>  failed to forget accessibility connection
> due to Error Domain=NSCocoaErrorDomain Code=4099 "Couldn’t communicate with
> a helper application." (The connection was invalidated from this process.)
> UserInfo=0x60800046e380 {NSDebugDescription=The connection was invalidated
> from this process.}
> timestamp: 19:09:19.969 Monday 29 December 2014
> process/thread/queue: Mac Linux USB Loader (257) / 0x103535000 /
> com.apple.NSXPCConnection.user.endpoint
> code: line 2972 of /SourceCache/ViewBridge/ViewBridge-46.2/NSRemoteView.m
> in __57-[NSRemoteView
> viewServiceMarshalProxy:withErrorHandler:]_block_invoke
> domain: communications-failure

I vaguely recall seeing these messages reported in a Forum post recently, in 
relation to a NSOpenPanel crash, suggesting the IPC here *is* to Powerbox, 
which I find a little odd.

This smells a little bit like a problem where functionality depends on what SDK 
the app is linked against.

— What happens, if your app is linked against the 10.10 SDK (deployment target 
10.8+), if you link it against the 10.9 SDK instead?

— Or, if your app is linked against the 10.9 SDK  (deployment target 10.8 or 
earlier), what happens if you link it against the 10.8 SDK instead? (This means 
using an earlier Xcode, though.)

Or, even simpler, perhaps you’ve accidentally used 10.10 API somewhere that 
doesn’t exist earlier. Building against the 10.9 SDK should uncover such 
errors, too.



___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

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:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Re: Application Crashing Under Mavericks, but not Yosemite (Entitlements Issue?)

2014-12-29 Thread Roland King

> On 30 Dec 2014, at 08:27, SevenBits  wrote:
> 
> Hey guys,
> 
> Maybe my experience is simply too narrow to be able to know how to resolve
> this issue, but I'm seriously confused by an issue I'm seeing in my Cocoa
> app.

What’s going on at the point the actual exception is thrown near the bottom of 
the logfile? That appears to be in your app’s windowDidLoad code. Is that a 
result of the earlier errors or a separate issue? Something somewhere is 
calling containsString: on something inappropriate. Can you symbolicate that 
(hahahaha yeah right, didn’t Xcode used to do that for you) and rule out that’s 
a contributing factor? 
___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

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:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com