Re: Application Activation Problem

2016-05-26 Thread Uli Kusterer
On 18 May 2016, at 12:44, Dave  wrote:
> I got side-tracked with some other issues and will be taking another look at 
> this on Friday and I will certainly have a good look at the available 
> methods/properties of NSWorkspace, but from memory I don’t think there is a 
> method that returns the currently active application, although I could be 
> wrong. If there were it would be relatively easy to do this.

 Not NSWorkspace, NSRunningApplication. You can get a list of running 
applications from NSWorkspace. NSRunningApplication.active can then be 
KVO-observed to find out when it becomes frontmost, according to the comments 
in that header.

Cheers,
-- Uli Kusterer
"The Witnesses of TeachText are everywhere..."
http://stacksmith.org





___

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 Activation Problem

2016-05-26 Thread Uli Kusterer
On 18 May 2016, at 14:25, Dave  wrote:
> My curiosity got the better of me and I looked at NSWorkspace again and found 
> the activeApplication but it was deprecated in 10.11, however when I looked 
> for closely I found frontmostApplication which is (I think) exactly what I 
> want! Thanks for the tip.

 That's even better than iterating runningApplications, I suppose. Though if 
the app you're launching is a GUI app, you may want -menuBarOwningApplication 
instead.

Cheers,
-- Uli Kusterer
"The Witnesses of TeachText are everywhere..."
http://stacksmith.org





___

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 Activation Problem

2016-05-26 Thread Dave

> On 26 May 2016, at 15:43, Uli Kusterer  wrote:
> 
> On 18 May 2016, at 14:25, Dave  wrote:
>> My curiosity got the better of me and I looked at NSWorkspace again and 
>> found the activeApplication but it was deprecated in 10.11, however when I 
>> looked for closely I found frontmostApplication which is (I think) exactly 
>> what I want! Thanks for the tip.
> 
> That's even better than iterating runningApplications, I suppose.

Yeah, it saves me writing a method to do the same thing!

> Though if the app you're launching is a GUI app, you may want 
> -menuBarOwningApplication instead.
> 

Ok, thanks for the tip, I still haven’t got back to this yet……...

All the Best
Dave


___

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

Popover arrow point never properly aligned

2016-05-26 Thread Rick Mann
I'm presenting a popover from a UINavigationBar UIBarButtonItem. The point of 
origin of the popover never seems to come out of the center of the 
UIBarButtonItem. The code I'm using is:

@IBAction
func
shareModel(inSender: AnyObject)
{
if let model = self.model
{
let source = ModelShareActivitySource(model)
let avc = UIActivityViewController(activityItems: [source], 
applicationActivities: nil)
avc.popoverPresentationController?.barButtonItem = self.shareButton
presentViewController(avc, animated: true, completion: nil)
}
}
@IBOutlet weak var shareButton: UIBarButtonItem!

Is anyone else seeing this?

-- 
Rick Mann
rm...@latencyzero.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

NSSplitViewController changes split size when changing viewcontrollers

2016-05-26 Thread Rick Mann
In my master-detail UI, selecting something on the left side of the split 
changes the view controller on the right (by removing the current one and 
adding the new one).

Each time I do this, it resets the position of the split based on some unknown 
but consistent criteria (each right-side view always ends up with the same 
width). This width is dependent on where I dragged the divider to before I 
changed views.

Anyway, once the user has moved the slider, I really don't want it to change 
position at all, unless there's a minimum/maximum width imposed by the sub 
views. That is, if the constraints of the new view can be satisfied with the 
current split position, it should not move the split position, but instead 
resize subviews.

How can I get it to behave like this?

Thanks.


-- 
Rick Mann
rm...@latencyzero.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

debugging AirDrop

2016-05-26 Thread Gerriet M. Denkmann
I have an OS X app (10.11.5) which has a button called AirDrop, which does:

- (IBAction)airDrop: (NSButton *)sender 
{
NSArray *shareItems = list of one or more urls of pdf files
NSSharingService *service = [ NSSharingService sharingServiceNamed: 
NSSharingServiceNameSendViaAirDrop];
service.delegate = self;//  probably not needed
[service performWithItems:shareItems];
}

Usually this just works:
I click the AirDrop button, a Panel slides down with a picture of the pdf (or a 
symbol for multiple files if more than one).
I grab my iPad (which has “AirDrop: Contacts Only" set) and unlock it.
The AirDrop panel on the Mac shows (after a few seconds) my Mac Login picture, 
I click it, and all is well.

Sometimes it does not work correctly:
In this case I have to set the iPad to “AirDrop: Everyone". A generic user 
picture will appear on the Mac and it will still work.

But sometimes it does not work at all: 
I can do whatever (like restarting the iPad; restarting the Mac) but still no 
picture of a recipient will appear in the Mac AirDrop Panel. 

How can I debug this?

Gerriet.


___

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

debugging AirDrop (update)

2016-05-26 Thread Gerriet M. Denkmann
I have an OS X app (10.11.5) which has a button called AirDrop, which does:

- (IBAction)airDrop: (NSButton *)sender 
{
NSArray *shareItems = list of one or more urls of pdf files
NSSharingService *service = [ NSSharingService sharingServiceNamed: 
NSSharingServiceNameSendViaAirDrop];
service.delegate = self;//  probably not needed
[service performWithItems:shareItems];
}

Usually this just works:
I click the AirDrop button, a Panel slides down with a picture of the pdf (or a 
symbol for multiple files if more than one).
I grab my iPad (which has “AirDrop: Contacts Only" set) and unlock it.
The AirDrop panel on the Mac shows (after a few seconds) my Mac Login picture, 
I click it, and all is well.

Sometimes it does not work correctly:
In this case I have to set the iPad to “AirDrop: Everyone". A generic user 
picture will appear on the Mac and it will still work.

But sometimes it does not work at all: 
I can do whatever (like restarting the iPad; restarting the Mac) but still no 
picture of a recipient will appear in the Mac AirDrop Panel. 

How can I debug this?

Gerriet.

Found some log messages, which seem to be related:

Clicking my AirDrop button:

27/05/2016 12:17:41.630 sharingd[17313]: 12:17:41.629 : Bonjour discovery 
started
27/05/2016 12:17:41.662 sharingd[17313]: 12:17:41.662 : BTLE advertiser Powered 
On
27/05/2016 12:17:41.664 sharingd[17313]: 12:17:41.663 : BTLE advertising hashes 
<01ca38ce b5742b51 4900>
27/05/2016 12:17:41.667 sharingd[17313]: 12:17:41.666 : 
SDBonjourBrowser::failedToStartAdvertisingWithError Error 
Domain=NSMachErrorDomain Code=8 "(os/kern) no access" 
UserInfo={NSLocalizedDescription=wirelessproxd can't start advertising at this 
time.}
27/05/2016 12:17:43.720 sharingd[17313]: 12:17:43.719 : 
SDBonjourBrowser::failedToStartAdvertisingWithError Error 
Domain=NSMachErrorDomain Code=8 "(os/kern) no access" 
UserInfo={NSLocalizedDescription=wirelessproxd can't start advertising at this 
time.}

Clicking “Cancel" in the AirDrop Panel:

27/05/2016 12:19:46.595 AirDrop[17426]: Error in CoreDragRemoveTrackingHandler: 
-1856
27/05/2016 12:19:46.595 AirDrop[17426]: Error in CoreDragRemoveReceiveHandler: 
-1856
27/05/2016 12:19:46.658 sharingd[17313]: 12:19:46.657 : Bonjour discovery 
stopped
27/05/2016 12:19:46.671 sharingd[17313]: 12:19:46.671 : BTLE advertising stopped

But still don’t know what to do.

Gerriet.


___

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