NSWorkspace launchApplication and gatekeeper

2014-01-09 Thread Totte Alm
Hello,

I'm moving an older but large inhouse application from 10.6/32-bit/GC to 
10.9/64-bit/ARC.
It uses an internal auto update functionally where the app can store itself 
into the database when it detects it is a new version, then the other users 
will get update reminders to download the latest version, which self updates.

Now, the tricky part on 10.9
I move myself to trash as theapp-old.app, unzips the fetched zipfile into 
/Applications (or where the user put it), all this works. The application is 
signed with a dev-id.
Then I use [NSWorkspace defaultWorkspace] launchApplication:pathstring] to 
launch the new copy.

[NSWorkspace defaultWorkspace] launchApplication:pathstring]  returns YES 
(which means the app is launched or running), but the new instance isn't 
started and I get this in the log which sounds very much like gatekeeper 
interference.
2014-01-09 13:11:33,981 launchservicesd[58]: Application App:x 
asn:0x0-563563 pid:2239 refs=7 @ 0x7fb00940b730 tried to be brought forward, 
but isn't in fPermittedFrontApps ( ( LSApplication:0x0-0x564564 pid=2247 
SecurityAgent)), so denying. : LASSession.cp #1481 SetFrontApplication() 
q=LSSession 15/0x186a5 queue
2014-01-09 13:11:33,982 WindowServer[102]: [cps/setfront] Failed setting the 
front application to x, psn 0x0-0x563563, securitySessionID=0x186a5, 
err=-13066

If I manually (in Finder) launch the application it works fine.

Anyone has a Ptr to what I'm missing here? 

/Totte



___

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: NSWorkspace launchApplication and gatekeeper

2014-01-09 Thread Totte Alm

9 jan 2014 kl. 14:52 skrev SevenBits sevenbitst...@gmail.com:

 Can't you just use Sparkle to do app updates? It handles all of this for you. 
 Just a thought.

It has more requirements and different once I think, webserver and update 
feeds. The update is downloaded from a database using SQL, there is other 
info that I need to display like who issued the update and when etc etc.
Maybe I can pilfer some functionality but it feels like I've solved 
everything (years ago) and it works except this issue. 
/ Totte


 
 
 On Thu, Jan 9, 2014 at 7:27 AM, Totte Alm to...@code66.se wrote:
 Hello,
 
 I'm moving an older but large inhouse application from 10.6/32-bit/GC to 
 10.9/64-bit/ARC.
 It uses an internal auto update functionally where the app can store itself 
 into the database when it detects it is a new version, then the other users 
 will get update reminders to download the latest version, which self 
 updates.
 
 Now, the tricky part on 10.9
 I move myself to trash as theapp-old.app, unzips the fetched zipfile into 
 /Applications (or where the user put it), all this works. The application is 
 signed with a dev-id.
 Then I use [NSWorkspace defaultWorkspace] launchApplication:pathstring] to 
 launch the new copy.
 
 [NSWorkspace defaultWorkspace] launchApplication:pathstring]  returns YES 
 (which means the app is launched or running), but the new instance isn't 
 started and I get this in the log which sounds very much like gatekeeper 
 interference.
 2014-01-09 13:11:33,981 launchservicesd[58]: Application App:x 
 asn:0x0-563563 pid:2239 refs=7 @ 0x7fb00940b730 tried to be brought forward, 
 but isn't in fPermittedFrontApps ( ( LSApplication:0x0-0x564564 pid=2247 
 SecurityAgent)), so denying. : LASSession.cp #1481 SetFrontApplication() 
 q=LSSession 15/0x186a5 queue
 2014-01-09 13:11:33,982 WindowServer[102]: [cps/setfront] Failed setting the 
 front application to x, psn 0x0-0x563563, securitySessionID=0x186a5, 
 err=-13066
 
 If I manually (in Finder) launch the application it works fine.
 
 Anyone has a Ptr to what I'm missing here?
 
 /Totte
 
 
 
 ___
 
 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/sevenbitstech%40gmail.com
 
 This email sent to sevenbitst...@gmail.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

Resizing Detail View of UISplitViewController

2014-01-09 Thread Viacheslav Karamov

Hello All,

I'm using a UISplitViewController in my iPad app and I don't really like 
the way the popover view slides in and covers a third of the screen and 
stays there when in Portrait mode.


I want it to look like it does when in Landscape mode. How can I resize 
the overall detail view including navigation bar?


Thank you in advance,
Viacheslav.
___

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: Auto Layout with NSSplitView, NSScrollView

2014-01-09 Thread Andy Lee
On Jan 6, 2014, at 11:54 AM, Fritz Anderson fri...@manoverboard.org wrote:
 On 4 Jan 2014, at 1:38 PM, thatsanicehatyouh...@me.com wrote:
 
 I like your user name.
 
 I have a couple of questions about using auto layout (AL) with NSSplitView 
 and NSScrollView. I have watched the (excellent) WWDC videos from 2012, but 
 am having problems.
 
 I'm trying to implement an NSSplitView
 
 [… that collapses one of the views if the user resizes it below a set 
 minimum.]
 
 The next thing I’d try (meaning I have no experience and no time to make the 
 experiment; others’ solutions would trump mine; and I seem to remember this 
 is a solved problem to be found in the archives of this list, Stack Overflow, 
 or [ugh] the Developer Forums) is to see whether listening to the collapsing 
 view’s NSFrameDidChangeNotification was of help. If the frame goes below 
 minimum width, replace the width constraint with a zero.

[same disclaimers as Fritz]

As far as I know (see disclaimers), there's no reason you can't implement split 
view delegate methods just because you're using Auto Layout, as long as you 
aren't calling setFrame:.  I would guess it's perfectly all right to implement 
splitView:constrainSplitPosition:ofSubviewAt:, examine the proposedPosition 
argument, and allow the view's width to be either zero or = the minimum width 
but not in between.

You might have to fiddle with constraints for the reason Fritz gives:

 Constraints for contained views would tend to push the collapsed view’s width 
 out, but reducing the priorities of some of the constraints on the views that 
 would push back should take care of that.

You could also add a *higher*-priority constraint that says the collapsed 
view's width must be 0, and this would trump the constraints that tend to push 
back.  I think.

--Andy


___

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

Fwd: Re: Auto Layout with NSSplitView, NSScrollView

2014-01-09 Thread Michael Starke

If I recall correctly, if you did implement ANY delegate method using
10.7 the split view did fall back to a non-autolayout aware mode. At
least that was my experince. It did change with 10.8. But take this with
a lot of caution. My memory tends to mess up those things :)

Ah. There was something:
http://www.cocoabuilder.com/archive/cocoa/326128-nssplitview-not-resizing-subviews-if-delegate-is-used.html#326128

-Michael

On 09.01.2014 16:51, Andy Lee wrote:

On Jan 6, 2014, at 11:54 AM, Fritz Anderson fri...@manoverboard.org wrote:

On 4 Jan 2014, at 1:38 PM, thatsanicehatyouh...@me.com wrote:

I like your user name.


I have a couple of questions about using auto layout (AL) with NSSplitView and 
NSScrollView. I have watched the (excellent) WWDC videos from 2012, but am 
having problems.
I'm trying to implement an NSSplitView


[… that collapses one of the views if the user resizes it below a set minimum.]
The next thing I’d try (meaning I have no experience and no time to make the 
experiment; others’ solutions would trump mine; and I seem to remember this is 
a solved problem to be found in the archives of this list, Stack Overflow, or 
[ugh] the Developer Forums) is to see whether listening to the collapsing 
view’s NSFrameDidChangeNotification was of help. If the frame goes below 
minimum width, replace the width constraint with a zero.


[same disclaimers as Fritz]

As far as I know (see disclaimers), there's no reason you can't implement split 
view delegate methods just because you're using Auto Layout, as long as you aren't 
calling setFrame:.  I would guess it's perfectly all right to implement 
splitView:constrainSplitPosition:ofSubviewAt:, examine the proposedPosition 
argument, and allow the view's width to be either zero or = the minimum width 
but not in between.
You might have to fiddle with constraints for the reason Fritz gives:


Constraints for contained views would tend to push the collapsed view’s width 
out, but reducing the priorities of some of the constraints on the views that 
would push back should take care of that.


You could also add a *higher*-priority constraint that says the collapsed 
view's width must be 0, and this would trump the constraints that tend to push 
back.  I think.

--Andy


--
___m i c h a e l   s t a r k e
   geschäftsführer
   HicknHack Software GmbH
   www.hicknhack-software.com

___k o n t a k t
   +49 (170) 3686136
   cont...@hicknhack.com

___H i c k n H a c k   S o f t w a r e   G m b H
   geschäftsführer - maik lathan | andreas reischuck | michael starke
   bayreuther straße 32
   01187 dresden
   amtsgericht dresden HRB 30351
   sitz - dresden


___

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: NSWorkspace launchApplication and gatekeeper

2014-01-09 Thread Ken Thomases
On Jan 9, 2014, at 6:27 AM, Totte Alm wrote:

 I'm moving an older but large inhouse application from 10.6/32-bit/GC to 
 10.9/64-bit/ARC.
 It uses an internal auto update functionally where the app can store itself 
 into the database when it detects it is a new version, then the other users 
 will get update reminders to download the latest version, which self 
 updates.
 
 Now, the tricky part on 10.9
 I move myself to trash as theapp-old.app, unzips the fetched zipfile into 
 /Applications (or where the user put it), all this works. The application is 
 signed with a dev-id.
 Then I use [NSWorkspace defaultWorkspace] launchApplication:pathstring] to 
 launch the new copy.
 
 [NSWorkspace defaultWorkspace] launchApplication:pathstring]  returns YES 
 (which means the app is launched or running), but the new instance isn't 
 started and I get this in the log which sounds very much like gatekeeper 
 interference.
 2014-01-09 13:11:33,981 launchservicesd[58]: Application App:x 
 asn:0x0-563563 pid:2239 refs=7 @ 0x7fb00940b730 tried to be brought forward, 
 but isn't in fPermittedFrontApps ( ( LSApplication:0x0-0x564564 pid=2247 
 SecurityAgent)), so denying. : LASSession.cp #1481 SetFrontApplication() 
 q=LSSession 15/0x186a5 queue
 2014-01-09 13:11:33,982 WindowServer[102]: [cps/setfront] Failed setting the 
 front application to x, psn 0x0-0x563563, securitySessionID=0x186a5, 
 err=-13066
 
 If I manually (in Finder) launch the application it works fine.

I don't think this has anything to do with Gatekeeper.  Gatekeeper only applies 
to quarantined downloads and downloads are only quarantined by explicit calls 
to the appropriate API.  It's good practice for web browsers, emails programs, 
and the like to quarantine the things they download, but the system doesn't 
enforce this.

Also, since you can launch it without incident from the Finder, there's no 
reason to suspect Gatekeeper thinks the app is suspicious.

The console messages you're seeing are about an already-running app – it's got 
a PID, etc. – not being set as the front app.  It would still be visible on the 
screen (and in the Dock and application switcher).  It was just denied from 
being made frontmost.

I recommend two things.  First, use -[NSWorkspace 
launchApplicationAtURL:options:configuration:error:] or some other URL-based 
method, rather than -[NSWorkspace launchApplication:], to launch the app.  I 
don't trust that passing a full path to -launchApplication: will reliably 
launch that specific copy of the app.

Second, use a trampoline program.  Quit the original instance of the app before 
attempting to launch the new one.  The first instance would launch the 
trampoline and quit itself.  The trampoline would wait for the first instance 
to quit and then launch the new app.  Waiting for the first instance to quit 
can be accomplished in a number of ways.  I'm partial to having a pipe open 
between the processes where the first app has the only write end and the 
trampoline has the read end.  When the first app process exits, the kernel will 
close its file descriptors including the write end of the pipe.  The trampoline 
will then get end-of-file on its read end.

Regards,
Ken


___

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: Resizing Detail View of UISplitViewController

2014-01-09 Thread Fritz Anderson
On 9 Jan 2014, at 8:49 AM, Viacheslav Karamov ubuntul...@yandex.ru wrote:

 I'm using a UISplitViewController in my iPad app and I don't really like the 
 way the popover view slides in and covers a third of the screen and stays 
 there when in Portrait mode.
 
 I want it to look like it does when in Landscape mode. How can I resize the 
 overall detail view including navigation bar?

In other words, you’d like the sidebar to be present at all times, and for the 
remainder of the screen to be narrow, instead of being covered. Right?

You can’t do that with UISplitViewController. Since you don’t need to track the 
visibility of the sidebar, it’s trivial to build your own. Look up container 
view / child view controller. 

There may be hacks to force UISplitViewController to do what you want, but 
they’d be harder to do than building your own solution, probably fragile, and 
probably unacceptable to the App Store reviewers.

— F

-- 
Fritz Anderson   fri...@mac.com
Xcode 5 Start to Finish: Available April 2014 from Addison Wesley


___

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: Status Bar problem

2014-01-09 Thread Caylan Larson
On Jan 3, 2014, at 3:54 AM, Roland King r...@rols.org wrote:

 
 But the iPad version does NOT work (status Bar overlaps):
 
 
 ...
 
 When I Toggle In-Call Status Bar the UILayoutContainerView does not change.
 BUT: here the status bar overlaps the top of the UITableView, which looks 
 rather ugly.
 
 What am I doing wrong?
 
 What does the in-call status bar on iPad mean anyway? You can't make calls on 
 them. 

The in call status bar is also used when another device is connected to your 
iPhone's “Personal Hotspot.”  Perhaps the LTE versions of iPads support this 
feature.  On the other hand, I would suspect navigation routing… but my quick 
iPad test didn’t show an updated status bar.

Caylan
___

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: Auto Layout with NSSplitView, NSScrollView

2014-01-09 Thread Andy Lee
That's a great thread, thanks!

BTW Apple removed the splitview-without-NSSplitView sample code that's 
mentioned in the thread.  For anyone still interested, someone named Darcy Liu 
seems to have been archiving all of Apple's sample code:

https://github.com/darcyliu/CocoaSampleCode

The splitview example is here:

https://github.com/darcyliu/CocoaSampleCode/tree/master/Cocoa_Autolayout_Demos/SplitView

And Darcy has a similar archive of iOS code:

https://github.com/darcyliu/SampleCode

You can't just download an individual sample project AFAICT -- you have to 
clone or download the entire repo -- but that's not such a bad thing.

--Andy

On Jan 9, 2014, at 11:00 AM, Michael Starke 
michael.sta...@hicknhack-software.com wrote:

 If I recall correctly, if you did implement ANY delegate method using
 10.7 the split view did fall back to a non-autolayout aware mode. At
 least that was my experince. It did change with 10.8. But take this with
 a lot of caution. My memory tends to mess up those things :)
 
 Ah. There was something:
 http://www.cocoabuilder.com/archive/cocoa/326128-nssplitview-not-resizing-subviews-if-delegate-is-used.html#326128
 
 -Michael
 
 On 09.01.2014 16:51, Andy Lee wrote:
 On Jan 6, 2014, at 11:54 AM, Fritz Anderson fri...@manoverboard.org wrote:
 On 4 Jan 2014, at 1:38 PM, thatsanicehatyouh...@me.com wrote:
 
 I like your user name.
 
 I have a couple of questions about using auto layout (AL) with NSSplitView 
 and NSScrollView. I have watched the (excellent) WWDC videos from 2012, 
 but am having problems.
 I'm trying to implement an NSSplitView
 
 [… that collapses one of the views if the user resizes it below a set 
 minimum.]
 The next thing I’d try (meaning I have no experience and no time to make 
 the experiment; others’ solutions would trump mine; and I seem to remember 
 this is a solved problem to be found in the archives of this list, Stack 
 Overflow, or [ugh] the Developer Forums) is to see whether listening to the 
 collapsing view’s NSFrameDidChangeNotification was of help. If the frame 
 goes below minimum width, replace the width constraint with a zero.
 
 [same disclaimers as Fritz]
 
 As far as I know (see disclaimers), there's no reason you can't implement 
 split view delegate methods just because you're using Auto Layout, as long 
 as you aren't calling setFrame:.  I would guess it's perfectly all right to 
 implement splitView:constrainSplitPosition:ofSubviewAt:, examine the 
 proposedPosition argument, and allow the view's width to be either zero or 
 = the minimum width but not in between.
 You might have to fiddle with constraints for the reason Fritz gives:
 
 Constraints for contained views would tend to push the collapsed view’s 
 width out, but reducing the priorities of some of the constraints on the 
 views that would push back should take care of that.
 
 You could also add a *higher*-priority constraint that says the collapsed 
 view's width must be 0, and this would trump the constraints that tend to 
 push back.  I think.
 
 --Andy
 
 -- 
 ___m i c h a e l   s t a r k e
   geschäftsführer
   HicknHack Software GmbH
   www.hicknhack-software.com
 
 ___k o n t a k t
   +49 (170) 3686136
   cont...@hicknhack.com
 
 ___H i c k n H a c k   S o f t w a r e   G m b H
   geschäftsführer - maik lathan | andreas reischuck | michael starke
   bayreuther straße 32
   01187 dresden
   amtsgericht dresden HRB 30351
   sitz - dresden
___

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: Resizing Detail View of UISplitViewController

2014-01-09 Thread Kyle Sluder
On Jan 9, 2014, at 8:59 AM, Fritz Anderson fri...@manoverboard.org wrote:
 
 In other words, you’d like the sidebar to be present at all times, and for 
 the remainder of the screen to be narrow, instead of being covered. Right?
 
 You can’t do that with UISplitViewController.

Really? I'm pretty sure implementing 
-splitView:shouldHideViewController:inOrientation: to return NO will make the 
sidebar visible in portrait.

Quoth the docs:

“Prior to iOS 5.0, the first view controller was always hidden in portrait 
orientations and always shown in landscape orientations. If you do not 
implement this method in your delegate object, that default behavior remains in 
effect.”

--Kyle Sluder
___

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: Auto Layout with NSSplitView, NSScrollView

2014-01-09 Thread Kyle Sluder
On Thu, Jan 9, 2014, at 07:51 AM, Andy Lee wrote:
 As far as I know (see disclaimers), there's no reason you can't implement
 split view delegate methods just because you're using Auto Layout, as
 long as you aren't calling setFrame:.

Nope. Please see the 10.8 AppKit Release Notes, which enumerate all the
delegate methods which will kick you out of Auto Layout mode:

 splitView:constrainMinCoordinate:ofSubviewAt:
 splitView:constrainMaxCoordinate:ofSubviewAt:
 splitView:resizeSubviewsWithOldSize:
 splitView:shouldAdjustSizeOfSubview:
 These methods are incompatible with auto layout. You can typically achieve 
 their effects and more with auto layout.

https://developer.apple.com/library/mac/releasenotes/AppKit/RN-AppKitOlderNotes/

 I would guess it's perfectly all
 right to implement splitView:constrainSplitPosition:ofSubviewAt:, examine
 the proposedPosition argument, and allow the view's width to be either
 zero or = the minimum width but not in between.

This is very much not allowed, and wouldn't have been the correct
approach even before auto layout.

To achieve this effect, add a mandatory greater-than-or-equal-to width
constraint to the subview you want to be collapsible, and implement
-splitView:canCollapseSubview: to return YES for that subview.

--Kyle Sluder
___

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: NSWorkspace launchApplication and gatekeeper

2014-01-09 Thread Totte Alm

9 jan 2014 kl. 17:26 skrev Ken Thomases k...@codeweavers.com:

 On Jan 9, 2014, at 6:27 AM, Totte Alm wrote:
 
 I'm moving an older but large inhouse application from 10.6/32-bit/GC to 
 10.9/64-bit/ARC.
 It uses an internal auto update functionally where the app can store itself 
 into the database when it detects it is a new version, then the other users 
 will get update reminders to download the latest version, which self 
 updates.
 
 Now, the tricky part on 10.9
 I move myself to trash as theapp-old.app, unzips the fetched zipfile into 
 /Applications (or where the user put it), all this works. The application is 
 signed with a dev-id.
 Then I use [NSWorkspace defaultWorkspace] launchApplication:pathstring] to 
 launch the new copy.
 
 [NSWorkspace defaultWorkspace] launchApplication:pathstring]  returns YES 
 (which means the app is launched or running), but the new instance isn't 
 started and I get this in the log which sounds very much like gatekeeper 
 interference.
 2014-01-09 13:11:33,981 launchservicesd[58]: Application App:x 
 asn:0x0-563563 pid:2239 refs=7 @ 0x7fb00940b730 tried to be brought forward, 
 but isn't in fPermittedFrontApps ( ( LSApplication:0x0-0x564564 pid=2247 
 SecurityAgent)), so denying. : LASSession.cp #1481 SetFrontApplication() 
 q=LSSession 15/0x186a5 queue
 2014-01-09 13:11:33,982 WindowServer[102]: [cps/setfront] Failed setting the 
 front application to x, psn 0x0-0x563563, securitySessionID=0x186a5, 
 err=-13066
 
 If I manually (in Finder) launch the application it works fine.
 
 I don't think this has anything to do with Gatekeeper.  Gatekeeper only 
 applies to quarantined downloads and downloads are only quarantined by 
 explicit calls to the appropriate API.  It's good practice for web browsers, 
 emails programs, and the like to quarantine the things they download, but the 
 system doesn't enforce this.
 
 Also, since you can launch it without incident from the Finder, there's no 
 reason to suspect Gatekeeper thinks the app is suspicious.
 
 The console messages you're seeing are about an already-running app – it's 
 got a PID, etc. – not being set as the front app.  It would still be visible 
 on the screen (and in the Dock and application switcher).  It was just denied 
 from being made frontmost.
 
 I recommend two things.  First, use -[NSWorkspace 
 launchApplicationAtURL:options:configuration:error:] or some other URL-based 
 method, rather than -[NSWorkspace launchApplication:], to launch the app.  I 
 don't trust that passing a full path to -launchApplication: will reliably 
 launch that specific copy of the app.
 
 Second, use a trampoline program.  Quit the original instance of the app 
 before attempting to launch the new one.  The first instance would launch the 
 trampoline and quit itself.  The trampoline would wait for the first instance 
 to quit and then launch the new app.  Waiting for the first instance to quit 
 can be accomplished in a number of ways.  I'm partial to having a pipe open 
 between the processes where the first app has the only write end and the 
 trampoline has the read end.  When the first app process exits, the kernel 
 will close its file descriptors including the write end of the pipe.  The 
 trampoline will then get end-of-file on its read end.

This looks like a good solution. The reason for [NSWorkspace 
launchApplication:], is that this is they way it has been working since 
10.4-ish.

Thanks

/ Totte

 
 Regards,
 Ken
 


___

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: Resizing Detail View of UISplitViewController

2014-01-09 Thread Vyacheslav Karamov

Thanks for help!

I came to the same conclusion after making a set of experiments.

09.01.2014 18:59, Fritz Anderson wrote:

On 9 Jan 2014, at 8:49 AM, Viacheslav Karamov ubuntul...@yandex.ru wrote:


I'm using a UISplitViewController in my iPad app and I don't really like the 
way the popover view slides in and covers a third of the screen and stays there 
when in Portrait mode.

I want it to look like it does when in Landscape mode. How can I resize the 
overall detail view including navigation bar?

In other words, you’d like the sidebar to be present at all times, and for the 
remainder of the screen to be narrow, instead of being covered. Right?

You can’t do that with UISplitViewController. Since you don’t need to track the 
visibility of the sidebar, it’s trivial to build your own. Look up container 
view / child view controller.

There may be hacks to force UISplitViewController to do what you want, but 
they’d be harder to do than building your own solution, probably fragile, and 
probably unacceptable to the App Store reviewers.

— F



___

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: Resizing Detail View of UISplitViewController

2014-01-09 Thread Vyacheslav Karamov
Thanks! Good point, but I forgot to say I need the possibility to 
hide/show sidebar by tapping nav bar item.

This might be ok for some cases, but I need detail view to be shrunk.

09.01.2014 19:34, Kyle Sluder wrote:

On Jan 9, 2014, at 8:59 AM, Fritz Anderson fri...@manoverboard.org wrote:

In other words, you’d like the sidebar to be present at all times, and for the 
remainder of the screen to be narrow, instead of being covered. Right?

You can’t do that with UISplitViewController.

Really? I'm pretty sure implementing 
-splitView:shouldHideViewController:inOrientation: to return NO will make the 
sidebar visible in portrait.

Quoth the docs:

“Prior to iOS 5.0, the first view controller was always hidden in portrait 
orientations and always shown in landscape orientations. If you do not 
implement this method in your delegate object, that default behavior remains in 
effect.”

--Kyle Sluder


___

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: Auto Layout with NSSplitView, NSScrollView

2014-01-09 Thread Andy Lee
On Jan 9, 2014, at 12:55 PM, SevenBits sevenbitst...@gmail.com wrote:
 On Thu, Jan 9, 2014 at 12:27 PM, Andy Lee ag...@mac.com wrote:
 That's a great thread, thanks!
 
 BTW Apple removed the splitview-without-NSSplitView sample code that's 
 mentioned in the thread.  For anyone still interested, someone named Darcy 
 Liu seems to have been archiving all of Apple's sample code:
 
 https://github.com/darcyliu/CocoaSampleCode
 
 The splitview example is here:
 
 https://github.com/darcyliu/CocoaSampleCode/tree/master/Cocoa_Autolayout_Demos/SplitView
 
 And Darcy has a similar archive of iOS code:
 
 https://github.com/darcyliu/SampleCode
 
 You can't just download an individual sample project AFAICT -- you have to 
 clone or download the entire repo -- but that's not such a bad thing.
 
 Unless you mind downloading over 300 MBs of code.

True.  I personally don't but I know others have slow connections and/or 
limited disk space.

 I guess if you're a
 fan of sample code then it doesn't matter. However, what I would be
 concerned about is how up to date some of the projects are. Some of
 them were last updated over 11 months ago, and who knows how often
 that person updates the repository?

I don't see anything to be concerned about.  The definitive source should 
always be Apple.  Furthermore, if Apple removes the sample code from their 
site, they presumably did so for a reason.  The code may have been poorly 
written, or it may use techniques that we should no longer use.  Still, there 
may be times when we'd like to see the removed examples anyway, and in those 
cases it's nice to have somewhere to look.

I ran the fake-SplitView example back when it was available, and it bugged me 
that I couldn't find it again.

--Andy


___

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: Help to debug NSPerformService..

2014-01-09 Thread Peter Teeson

On 2014-01-07, at 11:18 PM, Ken Thomases k...@codeweavers.com wrote:
 On Jan 7, 2014, at 9:57 PM, Peter Teeson wrote:
 In my app I have this:
 @interface Guess : NSTextField // populated programmatically
 …
 -(void)check; // method to programatically use the Service Look Up In 
 Dictionary
 @end
 @implementation Guess
 ...
 -(void)check { // Lookup word in dictionary
 // ** This is my problem
see revised code below
   BOOL res = NSPerformService(@Look Up In Dictionary, pasteboard); // 
 debug shows (BOOL) NO
 }
 ...
 @end
 
 If I manually select the text in the field by double clicking it, the 
 Services menu is populated and does contain
 Look Up In Dictionary.
 
 The slight bit of example code from Apple showing a use of NSPerformService() 
 uses +pasteboardWithUniqueName, not + generalPasteboard.  You could try that.
 https://developer.apple.com/library/mac/samplecode/PhotoSearch/Listings/MainWindowController_m.html

 Also, you can try launching your app with -NSDebugServices 
 com.apple.Dictionary to see if that's informative.

 That said, perhaps you're actually looking for the -[NSView 
 showDefinitionForAttributedString:…] methods.
 Regards,
 Ken
I revised my code as follows:
-(void)check { // Lookup word in dictionary
[self selectText:nil];
NSString *theString = [self stringValue];
NSPasteboard *pasteboard = [NSPasteboard pasteboardWithUniqueName];
[pasteboard declareTypes:[NSArray arrayWithObject:NSStringPboardType] 
owner:nil];
[pasteboard setString:theString  forType:NSStringPboardType];
NSInteger changeCount = [pasteboard clearContents];
// ** This is my problem
BOOL res = NSPerformService(@Look Up In Dictionary, pasteboard);  
  }
I edited the scheme for Debug to pass this when I run:
-NSDebugServices com.apple.Dictionary

 I run my app and create the contents of the TextField then 
press a Button whose Target is Guess (my sub-class of NSTextField) and whose 
Action is the check method:
This is what the Debug Console shows  
2014-01-09 15:15:15.333 Garble[7439:303] NSDebugServices=com.apple.Dictionary
Look Up in Dictionary (com.apple.Dictionary) is enabled in the services menu 
and disabled in the context menu, by the standard Services policy.
Look Up in Dictionary (com.apple.Dictionary) is enabled in the services menu 
and disabled in the context menu, by the standard Services policy.

But if I manually select the TextField by double clicking and using the 
Services menu 
The Debug Console showed this:
2014-01-09 15:12:32.506 Garble[7427:303] NSDebugServices=com.apple.Dictionary
Look Up in Dictionary (com.apple.Dictionary) is enabled in the services menu 
and disabled in the context menu, by the standard Services policy.
Look Up in Dictionary (com.apple.Dictionary) is enabled in the services menu 
and disabled in the context menu, by the standard Services policy.
// This line shows up as soon as I get to the Services menu
Look Up in Dictionary (com.apple.Dictionary) has been approved by default, as 
it does not contain any required context.

 ^^  // my emphasis
Double clicking a word in a TextEdit doc and selecting the Services menu 
produces the same Debug Console output.

So clearly there is something missing from my app. My plist does not have a 
Required Context as I'm not offering (providing) a service.
Like many others I'm trying to use one - namely Look Up In Dictionary. Except 
in my case I want to do it from within my app, not manually.

I'm lost as to what is wrong. It works if I select the Service manually but not 
if I try to do so programmatically.

Thoughts? Suggestions?

TIA

Peter


___

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: Auto Layout with NSSplitView, NSScrollView

2014-01-09 Thread Ken Ferry
On Thu, Jan 9, 2014 at 9:48 AM, Kyle Sluder k...@ksluder.com wrote:

 To achieve this effect, add a mandatory greater-than-or-equal-to width
 constraint to the subview you want to be collapsible, and implement
 -splitView:canCollapseSubview: to return YES for that subview.


Yeah - not too much to it!

BUT, looking quickly at the github project, the delegate is set incorrectly.

The delegate is hooked to the NSApplication instance, while the delegate
methods are implemented in the app delegate.
___

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: Help to debug NSPerformService..

2014-01-09 Thread Ken Thomases
On Jan 9, 2014, at 2:35 PM, Peter Teeson wrote:

 Like many others I'm trying to use one - namely Look Up In Dictionary. Except 
 in my case I want to do it from within my app, not manually.

On 2014-01-07, at 11:18 PM, Ken Thomases k...@codeweavers.com wrote:

 That said, perhaps you're actually looking for the -[NSView 
 showDefinitionForAttributedString:…] methods.

You didn't specifically respond to this suggestion.  Is there a reason you're 
not using one of the above methods?

Regards,
Ken


___

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: Auto Layout with NSSplitView, NSScrollView

2014-01-09 Thread Andy Lee
On Jan 9, 2014, at 12:48 PM, Kyle Sluder k...@ksluder.com wrote:
 On Thu, Jan 9, 2014, at 07:51 AM, Andy Lee wrote:
 As far as I know (see disclaimers), there's no reason you can't implement
 split view delegate methods just because you're using Auto Layout, as
 long as you aren't calling setFrame:.
 
 Nope. Please see the 10.8 AppKit Release Notes, which enumerate all the
 delegate methods which will kick you out of Auto Layout mode:
 
 splitView:constrainMinCoordinate:ofSubviewAt:
 splitView:constrainMaxCoordinate:ofSubviewAt:
 splitView:resizeSubviewsWithOldSize:
 splitView:shouldAdjustSizeOfSubview:
 These methods are incompatible with auto layout. You can typically achieve 
 their effects and more with auto layout.
 
 https://developer.apple.com/library/mac/releasenotes/AppKit/RN-AppKitOlderNotes/

Right -- that's also mentioned in the thread Michael linked to.

 
 I would guess it's perfectly all
 right to implement splitView:constrainSplitPosition:ofSubviewAt:, examine
 the proposedPosition argument, and allow the view's width to be either
 zero or = the minimum width but not in between.
 
 This is very much not allowed, and wouldn't have been the correct
 approach even before auto layout.

You'd think splitView:constrainSplitPosition:ofSubviewAt: would be included in 
the above list, but it isn't.  I tried implementing it and it didn't disable 
Auto Layout, as, for example, splitView:constrainMinCoordinate:ofSubviewAt: 
does.  So, going by the omission from the docs and from empirical results it 
seems to me this delegate method is allowed.

Maybe it was left off the do-not-use list because there are uses for it that 
are not easily done with Auto Layout -- for example, the one described in the 
docs:

 For example, if a subview’s height must be a multiple of a certain number, 
 use this method to return the multiple nearest to proposedPosition.


In any case, to collapse the view I did indeed have to fiddle with constraints 
within the delegate method, which worked, but was ugly and totally unnecessary 
because:

 To achieve this effect, add a mandatory greater-than-or-equal-to width
 constraint to the subview you want to be collapsible, and implement
 -splitView:canCollapseSubview: to return YES for that subview.

Oh, of course -- it's that simple.  Thanks.  I was worried that the collapsing 
might cause a conflict with constraints on views inside the collapsed view.  
But I just tried it and it works, which is exactly what one would hope.

The key point is that it *is* okay to implement *certain* split view delegate 
methods.

--Andy

___

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: Auto Layout with NSSplitView, NSScrollView

2014-01-09 Thread Andy Lee
On Jan 9, 2014, at 12:48 PM, Kyle Sluder k...@ksluder.com wrote:
 Nope. Please see the 10.8 AppKit Release Notes, which enumerate all the
 delegate methods which will kick you out of Auto Layout mode:
 
 splitView:constrainMinCoordinate:ofSubviewAt:
 splitView:constrainMaxCoordinate:ofSubviewAt:
 splitView:resizeSubviewsWithOldSize:
 splitView:shouldAdjustSizeOfSubview:
 These methods are incompatible with auto layout. You can typically achieve 
 their effects and more with auto layout.
 
 https://developer.apple.com/library/mac/releasenotes/AppKit/RN-AppKitOlderNotes/

I'd like the docs for each of these methods to mention this.  Ideally, to 
remove all doubt for the reader, the docs for the other delegate methods would 
also confirm that it's okay to implement them in the sense that they won't 
disable Auto Layout.

I'll take a couple of minutes to submit docs feedback... later.  As usual I've 
now spent time on something immediately after saying I didn't have time to 
spend. :)

--Andy

___

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

Fixed format report document building

2014-01-09 Thread jonat...@mugginsoft.com
Windows WPF has a fixed format document API. Its documentation states:

Fixed documents are intended for applications that require a precise what you 
see is what you get (WYSIWYG) presentation, independent of the display or 
printer hardware used. Typical uses for fixed documents include desktop 
publishing, word processing, and form layout, where adherence to the original 
page design is critical.

What is the best approach for generating fixed format report documents in Cocoa?

My thoughts:

1. I can build NSView instances in IB, bind them and print to PDF. Okay for 
simple stuff but it is not a document generation API.
2. Obviously HTML can be rendered as a PDF but this lacks the precise placement 
of a fixed document.
3. XSLT and XSL-FO to PDF is also a possibility but I have no experience with 
this approach.

Other thoughts appreciated.

Jonathan












___

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: Fixed format report document building

2014-01-09 Thread Kyle Sluder
On Thu, Jan 9, 2014, at 01:54 PM, jonat...@mugginsoft.com wrote:
 Windows WPF has a fixed format document API. Its documentation states:
 
 Fixed documents are intended for applications that require a precise
 what you see is what you get (WYSIWYG) presentation, independent of the
 display or printer hardware used. Typical uses for fixed documents
 include desktop publishing, word processing, and form layout, where
 adherence to the original page design is critical.
 
 What is the best approach for generating fixed format report documents in
 Cocoa?
 
 My thoughts:
 
 1. I can build NSView instances in IB, bind them and print to PDF. Okay
 for simple stuff but it is not a document generation API.

This is exactly AppKit's document generation API. It's how TextEdit,
etc. generate their print output. They create (or reuse) an NSTextView,
construct an NSPrintOperation around that view, and run the print
operation.

Please read The AppKit Printing API:
https://developer.apple.com/library/mac/documentation/cocoa/conceptual/Printing/osxp_printingapi/osxp_printingapi.html

--Kyle Sluder
___

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: Help to debug NSPerformService..

2014-01-09 Thread Peter Teeson

On 2014-01-09, at 3:58 PM, Ken Thomases k...@codeweavers.com wrote:
 On Jan 9, 2014, at 2:35 PM, Peter Teeson wrote:
 Like many others I'm trying to use one - namely Look Up In Dictionary. 
 Except in my case I want to do it from within my app, not manually.
 On 2014-01-07, at 11:18 PM, Ken Thomases k...@codeweavers.com wrote:
 That said, perhaps you're actually looking for the -[NSView 
 showDefinitionForAttributedString:…] methods.
 You didn't specifically respond to this suggestion.  Is there a reason you're 
 not using one of the above methods?
 Regards,
 Ken
Yes I did see your suggestion(s), (thank you for them) and am working through 
them in order. I just haven't got that far yet.
In fact I am trying to understand the 2nd of those 2 methods.

thanks again for your help///

Peter
___

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

CALayerGetSuperlayer called on instance of NSPathStore2

2014-01-09 Thread Rick Mann
I got this error running my iPad app in the Simulator. Xcode 5.0.2, iOS 7.

CALayerGetSuperlayer called on instance of NSPathStore2


Googling it turns up literally no documents.


-- 
Rick





signature.asc
Description: Message signed with OpenPGP using GPGMail
___

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: CALayerGetSuperlayer called on instance of NSPathStore2

2014-01-09 Thread David Duncan
Treat it as an under-retained object error. Somewhere you have a layer that was 
released and replaced with an NSString that held a path.

On Jan 9, 2014, at 4:00 PM, Rick Mann rm...@latencyzero.com wrote:

 I got this error running my iPad app in the Simulator. Xcode 5.0.2, iOS 7.
 
   CALayerGetSuperlayer called on instance of NSPathStore2
 
 
 Googling it turns up literally no documents.
 
 
 -- 
 Rick
 
 
 
 ___
 
 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/david.duncan%40apple.com
 
 This email sent to david.dun...@apple.com

--
David Duncan


___

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: CALayerGetSuperlayer called on instance of NSPathStore2

2014-01-09 Thread Rick Mann
I turned on Zombies and found this, thank you, although I have no idea where it 
is.

On Jan 9, 2014, at 16:07 , David Duncan david.dun...@apple.com wrote:

 Treat it as an under-retained object error. Somewhere you have a layer that 
 was released and replaced with an NSString that held a path.
 
 On Jan 9, 2014, at 4:00 PM, Rick Mann rm...@latencyzero.com wrote:
 
 I got this error running my iPad app in the Simulator. Xcode 5.0.2, iOS 7.
 
  CALayerGetSuperlayer called on instance of NSPathStore2
 
 
 Googling it turns up literally no documents.
 
 
 -- 
 Rick
 
 
 
 ___
 
 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/david.duncan%40apple.com
 
 This email sent to david.dun...@apple.com
 
 --
 David Duncan


-- 
Rick





signature.asc
Description: Message signed with OpenPGP using GPGMail
___

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

Validation of fields in a navigation stack

2014-01-09 Thread Rick Mann
What's the right way to validate fields in an editable detail view in a 
navigation stack? It seems that the API doesn't really provide a good means to 
do so without a lot of contortions, and so I wonder what the intended behavior 
is.

Here's what I've got: A UINavigationController stack with a UITableView that 
shows a list of Jobs. You can add a new job, or select an existing job, and it 
pushes a new UITableViewController that is a detail view of the Job. Some of 
the fields in this detail view are editable (i.e. Name).

I don't want to allow the user to specify an empty name. So I had a separate 
Save button in the top-right of the nav bar, and I would validate everything 
in there before actually saving the changes to Core Data. I also had to 
subclass UINavigationController to prompt the user to discard changes if they 
tapped the back button (I also had to do this if they did something else to 
dismiss the UIPopover all this lives in).

For other reasons, I'd like to change this behavior a bit to avoid the save 
step all together, and to always save any change. But I still need to validate 
that they don't try to save an empty name. I'm trying to do this with 
-[UITextFieldDelegate textFieldShouldEndEditing:], in which I present an alert 
and return NO if the field is empty. But that doesn't work if they tap the 
back button. In this case, I'm content with simply undoing whatever change 
they made and not saving the changes without prompting, but I have to be able 
to detect that that's what's happening. There is no 
UINavigationControllerDelegate method for popping a view controller, only 
showing a new one.

I guess I could set a flag in -viewWillDisappear: indicating that the field is 
ending editing because the view is going away, and save or discard (without an 
alert) in that case.

What are your thoughts?

-- 
Rick





signature.asc
Description: Message signed with OpenPGP using GPGMail
___

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: Validation of fields in a navigation stack

2014-01-09 Thread Luther Baker
Create your own UIBarButtonItem button ... set it on the navigation item's 
leftBarButton property. Do what you want when they tap it with your own handler.

The left bar button will cover the back button.

 On Jan 9, 2014, at 6:22 PM, Rick Mann rm...@latencyzero.com wrote:
 
 What's the right way to validate fields in an editable detail view in a 
 navigation stack? It seems that the API doesn't really provide a good means 
 to do so without a lot of contortions, and so I wonder what the intended 
 behavior is.
 
 Here's what I've got: A UINavigationController stack with a UITableView that 
 shows a list of Jobs. You can add a new job, or select an existing job, and 
 it pushes a new UITableViewController that is a detail view of the Job. Some 
 of the fields in this detail view are editable (i.e. Name).
 
 I don't want to allow the user to specify an empty name. So I had a separate 
 Save button in the top-right of the nav bar, and I would validate 
 everything in there before actually saving the changes to Core Data. I also 
 had to subclass UINavigationController to prompt the user to discard changes 
 if they tapped the back button (I also had to do this if they did something 
 else to dismiss the UIPopover all this lives in).
 
 For other reasons, I'd like to change this behavior a bit to avoid the save 
 step all together, and to always save any change. But I still need to 
 validate that they don't try to save an empty name. I'm trying to do this 
 with -[UITextFieldDelegate textFieldShouldEndEditing:], in which I present an 
 alert and return NO if the field is empty. But that doesn't work if they tap 
 the back button. In this case, I'm content with simply undoing whatever 
 change they made and not saving the changes without prompting, but I have to 
 be able to detect that that's what's happening. There is no 
 UINavigationControllerDelegate method for popping a view controller, only 
 showing a new one.
 
 I guess I could set a flag in -viewWillDisappear: indicating that the field 
 is ending editing because the view is going away, and save or discard 
 (without an alert) in that case.
 
 What are your thoughts?
 
 -- 
 Rick
 
 
 
 ___
 
 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/lutherbaker%40gmail.com
 
 This email sent to lutherba...@gmail.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: Help to debug NSPerformService..

2014-01-09 Thread Peter Teeson
On 2014-01-09, at 6:42 PM, Peter Teeson ptee...@icloud.com wrote:
 On 2014-01-09, at 3:58 PM, Ken Thomases k...@codeweavers.com wrote:
 On Jan 9, 2014, at 2:35 PM, Peter Teeson wrote:
 Like many others I'm trying to use one - namely Look Up In Dictionary. 
 Except in my case I want to do it from within my app, not manually.
 On 2014-01-07, at 11:18 PM, Ken Thomases k...@codeweavers.com wrote:
 That said, perhaps you're actually looking for the -[NSView 
 showDefinitionForAttributedString:…] methods.
 You didn't specifically respond to this suggestion.  Is there a reason 
 you're not using one of the above methods?
 Regards,
 Ken
 Yes I did see your suggestion(s), (thank you for them) and am working through 
 them in order. I just haven't got that far yet.
 In fact I am trying to understand the 2nd of those 2 methods.
 
 thanks again for your help///

Well well well I got it to work thanks to your nudging! Took me this long to 
understand those methods.
I use the simpler one. Anyway my gratitude for your patience and for 
Socratically teaching me.
This is a much cleaner solution for my case than using NSPerformService.

respect….

Peter




___

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