Re: Talking to other apps

2014-08-04 Thread Jerry Krinock

On 2014 Aug 03, at 23:54, Gerriet M. Denkmann  wrote:

> NSPerformService (which also has the feel of not being well-loved), XPC, or 
> what else?

Yes.  Start by looking at XPC.


___

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: Talking to other apps

2014-08-04 Thread Pax
Why would you not use NSNotificationCenter for this?  

On 4 Aug 2014, at 15:51, Jerry Krinock  wrote:

> 
> On 2014 Aug 03, at 23:54, Gerriet M. Denkmann  wrote:
> 
>> NSPerformService (which also has the feel of not being well-loved), XPC, or 
>> what else?
> 
> Yes.  Start by looking at XPC.
> 
> 
> ___
> 
> 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/45rpmlists%40googlemail.com
> 
> This email sent to 45rpmli...@googlemail.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: Talking to other apps

2014-08-04 Thread Kyle Sluder
On Aug 4, 2014, at 7:55 AM, Pax <45rpmli...@googlemail.com> wrote:
> 
> Why would you not use NSNotificationCenter for this?  

Because that doesn’t do IPC.

And NSDistributedNotificationCenter is severely restricted in sandboxed apps.

--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: Talking to other apps

2014-08-04 Thread Jens Alfke

> On Aug 3, 2014, at 11:54 PM, Gerriet M. Denkmann  wrote:
> 
> My app wants to talk to some app-friend. Like sending a string and getting 
> another string back. Or something slightly more complicated.

AppleEvents is the traditional mechanism for inter-app messaging.

—Jens
___

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: Talking to other apps

2014-08-04 Thread Kevin Meaney
When you say app-friend, what do you mean? Another application? An XPC service? 
Some other kind of service?

If your App is sandboxed and the service is not an xpc service embedded in your 
application then I think your pretty much out of luck.

Kevin

On 4 Aug 2014, at 07:54, Gerriet M. Denkmann  wrote:

> My app wants to talk to some app-friend. Like sending a string and getting 
> another string back. Or something slightly more complicated.
> 
> In the good old days I would have used Distributed Objects, but this seems to 
> be no longer the fashion. Xcode 6 does not provide any documentation about 
> this (or I can't find it).
> 
> So, what to do?
> NSPerformService (which also has the feel of not being well-loved), XPC, or 
> what else?
> 
> 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/ktam%40yvs.eu.com
> 
> This email sent to k...@yvs.eu.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: Talking to other apps

2014-08-04 Thread Gerriet M. Denkmann

On 4 Aug 2014, at 22:57, Kevin Meaney  wrote:

> When you say app-friend, what do you mean? Another application? An XPC 
> service? Some other kind of service?

I mean two apps, which are both written (and thus can be modified) by me.
I really should have mentioned this in my original post. Sorry about this.

> 
> If your App is sandboxed and the service is not an xpc service embedded in 
> your application then I think your pretty much out of luck.
> 
> Kevin
> 
> On 4 Aug 2014, at 07:54, Gerriet M. Denkmann  wrote:
> 
>> My app wants to talk to some app-friend. Like sending a string and getting 
>> another string back. Or something slightly more complicated.
>> 
>> In the good old days I would have used Distributed Objects, but this seems 
>> to be no longer the fashion. Xcode 6 does not provide any documentation 
>> about this (or I can't find it).
>> 
>> So, what to do?
>> NSPerformService (which also has the feel of not being well-loved), XPC, or 
>> what else?
>> 
>> 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

Re: Talking to other apps

2014-08-04 Thread Scott Ribe
On Aug 4, 2014, at 11:23 AM, Gerriet M. Denkmann  wrote:

> I mean two apps, which are both written (and thus can be modified) by me.
> I really should have mentioned this in my original post. Sorry about this.

Showing my age here, but as an old UNIX troll, and assuming the apps are not 
sandboxed, I'd just use domain sockets.



-- 
Scott Ribe
scott_r...@elevated-dev.com
http://www.elevated-dev.com/
(303) 722-0567 voice





___

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: Talking to other apps

2014-08-04 Thread Uli Kusterer
On 04 Aug 2014, at 08:54, Gerriet M. Denkmann  wrote:
> My app wants to talk to some app-friend. Like sending a string and getting 
> another string back. Or something slightly more complicated.

 I don't think there's a good way to do this if you're sandboxed. But as a 
last-ditch-workaround you could look into abusing NSUserDefaults if it's simple 
communication of tiny bobs of data. You can have a domain that is shared by two 
apps from the same manufacturer.

Cheers,
-- Uli Kusterer
"The Witnesses of TeachText are everywhere..."
http://www.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: Talking to other apps

2014-08-04 Thread Scott Ribe
On Aug 4, 2014, at 11:47 AM, Uli Kusterer  wrote:

> You can have a domain that is shared by two apps from the same manufacturer.

Careful, I've had lots of problems with that--changes to defaults not being 
saved when you synch, and so forth.

-- 
Scott Ribe
scott_r...@elevated-dev.com
http://www.elevated-dev.com/
(303) 722-0567 voice





___

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: Talking to other apps

2014-08-04 Thread Jens Alfke

> On Aug 4, 2014, at 10:41 AM, Scott Ribe  wrote:
> 
> Showing my age here, but as an old UNIX troll, and assuming the apps are not 
> sandboxed, I'd just use domain sockets.
> 
> 

I have done this, and it’s surprisingly painful. I’d never do it again.

_Using_ the sockets is pretty easy (assuming you enjoy implementing framing 
protocols). The hard part is that you have to have a pseudo-file, located in 
the filesystem, to represent a Unix-domain socket. So you have to find a hidden 
place to create this ‘file’ with a randomly-chosen name (unless you don’t care 
about DoS attacks), give it the proper permissions, somehow transmit knowledge 
of that location to the other app, and clean it up when you’re done.

Doing this instead of using XPC or AppleEvents is like carving your own wheel 
out of stone instead of just going to a store and buying one.

—Jens
___

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: Talking to other apps

2014-08-04 Thread Alex Zavatone
If you want to go down the sockets path, there are clear examples on using 
NSStream, sockets and Bonjour to send info between apps that are on the same 
Mac.  Check out the PictureSharing sample and other NSStream samples that are 
included in the Xcode help.

All I had to do to get this to work was to change the name of the folder that 
specified the pictures transmitted and pictures directory on lines 163 and 173 
in ServerAppDelegate.m file.

The project is a 2 app workspace that sends a picture from one app to another 
on the same Mac.

It might be overkill, but it does the trick.

Hope this helps,
Alex Zavatone

On Aug 4, 2014, at 1:41 PM, Scott Ribe wrote:

> On Aug 4, 2014, at 11:23 AM, Gerriet M. Denkmann  wrote:
> 
>> I mean two apps, which are both written (and thus can be modified) by me.
>> I really should have mentioned this in my original post. Sorry about this.
> 
> Showing my age here, but as an old UNIX troll, and assuming the apps are not 
> sandboxed, I'd just use domain sockets.
> 
> 
> 
> -- 
> Scott Ribe
> scott_r...@elevated-dev.com
> http://www.elevated-dev.com/
> (303) 722-0567 voice
> 
> 
> 
> 
> 
> ___
> 
> 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/zav%40mac.com
> 
> This email sent to z...@mac.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

Preventing empty NSTextFields that use NSNumberFormatter

2014-08-04 Thread Sean McBride
Hi all,

NSNumberFormatter, applied to an NSTextField, will very nicely reject things 
like letters, and optionally a bunch of things like negative numbers, 
non-integers, etc.

But I've just noticed that it doesn't seem to help if the textfield is left 
entirely empty.  Is that not something NSNumberFormatter can help with?  I just 
find that surprising with all the other options it has...

If it can't, I guess the best choices are using NSControlTextEditingDelegate or 
key value validation...?

Thanks,

-- 

Sean McBride, B. Eng s...@rogue-research.com
Rogue Researchwww.rogue-research.com 
Mac Software Developer  Montréal, Québec, Canada



___

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: Talking to other apps

2014-08-04 Thread Jens Alfke

> On Aug 4, 2014, at 11:02 AM, Alex Zavatone  wrote:
> 
> If you want to go down the sockets path, there are clear examples on using 
> NSStream, sockets and Bonjour to send info between apps that are on the same 
> Mac.  Check out the PictureSharing sample and other NSStream samples that are 
> included in the Xcode help.

If you do this you’ve created a networked app, whether you need that 
functionality or not. With that come lots of extra security concerns — do you 
want anyone in the world to be able to anonymously send you pictures? Are you 
100% certain your stream code is robust against bad data and won’t crash or 
overwrite memory or allow access to arbitrary local files? Also, by using 
Bonjour you’re now actively advertising your app’s presence to the LAN you’re 
on, making it very easy for anyone nearby to find and connect to.

You can mitigate this by binding your listener socket to only the loopback 
interface (127.0.0.1) which will prevent external connections. Of course you’re 
still advertising a service to the LAN that no one else can connect to, which 
seems pointless, but I don’t think there’s any way to restrict Bonjour services 
to localhost.

—Jens
___

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: Talking to other apps

2014-08-04 Thread Uli Kusterer
On 04.08.2014, at 19:51, Scott Ribe  wrote:
> On Aug 4, 2014, at 11:47 AM, Uli Kusterer  
> wrote:
> 
>> You can have a domain that is shared by two apps from the same manufacturer.
> 
> Careful, I've had lots of problems with that--changes to defaults not being 
> saved when you synch, and so forth.

 What OS version was that with? It's definitely not easy in the old Prefs 
mechanism, but it should have improved a lot with the new prefs in 10.9 (or was 
it already in 10.8?) Well, basically there's now a central prefs server, so 
those caching issues should be less of a problem.

 That said, I've so far been lucky enough to not have to ship IAC in sandboxed 
apps, so I defer to anyone who has a more recent and deeper experience.

Cheers,
-- Uli Kusterer
"The Witnesses of TeachText are everywhere..."
http://www.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: Talking to other apps

2014-08-04 Thread Scott Ribe
On Aug 4, 2014, at 2:23 PM, Uli Kusterer  wrote:

> What OS version was that with? It's definitely not easy in the old Prefs 
> mechanism, but it should have improved a lot with the new prefs in 10.9 (or 
> was it already in 10.8?) Well, basically there's now a central prefs server, 
> so those caching issues should be less of a problem.

10.6? 10.7? It was unreliable enough that I gave up long ago, before 10.8 & 
10.9. So it may very well work just fine if you don't need to support older OS 
versions.

-- 
Scott Ribe
scott_r...@elevated-dev.com
http://www.elevated-dev.com/
(303) 722-0567 voice





___

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: Talking to other apps

2014-08-04 Thread Kyle Sluder
On Mon, Aug 4, 2014, at 03:23 PM, Uli Kusterer wrote:
> On 04.08.2014, at 19:51, Scott Ribe  wrote:
> > On Aug 4, 2014, at 11:47 AM, Uli Kusterer  
> > wrote:
> > 
> >> You can have a domain that is shared by two apps from the same 
> >> manufacturer.
> > 
> > Careful, I've had lots of problems with that--changes to defaults not being 
> > saved when you synch, and so forth.
> 
>  What OS version was that with? It's definitely not easy in the old Prefs
>  mechanism, but it should have improved a lot with the new prefs in 10.9
>  (or was it already in 10.8?) Well, basically there's now a central prefs
>  server, so those caching issues should be less of a problem.

Please don't do this. David might have a heart attack if he has to
maintain compatibility with more apps that do this kind of stuff.

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

applicationWillFinishLaunching vs. applicationDidFinishLaunching for NSDocument-based apps

2014-08-04 Thread Daryle Walker
A lot of sample code I see on web pages about application delegates use the 
applicationDidFinishLaunching: method for setting up any application-global 
data or routines.  I just read a page about the Cocoa app initialization order, 
and it had the various NSDocument and NSDocumentController routines that create 
documents (blank, for opening, for printing, for non-visible processing) upon 
app-open occur before applicationDidFinishLaunching:.  So I overrode 
applicationWillFinishLaunching: since my document subclass referenced a 
user-preference, needing me to initialize the user preferences before that.  Do 
I got it right here?

(If I’m right, this looks like a guide point for some Cocoa hint page.)

Hmm, what kinds of code would have to be done in the “Did” version?  The app 
code I’ve generally seen with a “Did” version could move it to a “Will” version.

— 
Daryle Walker
Mac, Internet, and Video Game Junkie
darylew AT mac DOT 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: applicationWillFinishLaunching vs. applicationDidFinishLaunching for NSDocument-based apps

2014-08-04 Thread Lee Ann Rucker

On Aug 4, 2014, at 1:42 PM, Daryle Walker  wrote:

> A lot of sample code I see on web pages about application delegates use the 
> applicationDidFinishLaunching: method for setting up any application-global 
> data or routines.  I just read a page about the Cocoa app initialization 
> order, and it had the various NSDocument and NSDocumentController routines 
> that create documents (blank, for opening, for printing, for non-visible 
> processing) upon app-open occur before applicationDidFinishLaunching:.  So I 
> overrode applicationWillFinishLaunching: since my document subclass 
> referenced a user-preference, needing me to initialize the user preferences 
> before that.  Do I got it right here?
> 
> (If I’m right, this looks like a guide point for some Cocoa hint page.)
> 
> Hmm, what kinds of code would have to be done in the “Did” version?  The app 
> code I’ve generally seen with a “Did” version could move it to a “Will” 
> version.

“Did” is where I put things like “well, no documents were opened, so show the 
UI that’s appropriate for us since an untitled document isn’t what we want"
___

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: Preventing empty NSTextFields that use NSNumberFormatter

2014-08-04 Thread Keary Suska

On Aug 4, 2014, at 12:01 PM, Sean McBride  wrote:

> NSNumberFormatter, applied to an NSTextField, will very nicely reject things 
> like letters, and optionally a bunch of things like negative numbers, 
> non-integers, etc.
> 
> But I've just noticed that it doesn't seem to help if the textfield is left 
> entirely empty.  Is that not something NSNumberFormatter can help with?  I 
> just find that surprising with all the other options it has...

Unfortunately, no.

> If it can't, I guess the best choices are using NSControlTextEditingDelegate 
> or key value validation...?

Yes, or subclass. If your backing property is a C primitive you could use 
setNilValueForKey to force nil to mean something.

HTH,

Keary Suska
Esoteritech, Inc.
"Demystifying technology for your home or business"


___

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: Talking to other apps

2014-08-04 Thread Kyle Sluder
On Mon, Aug 4, 2014, at 04:17 PM, Uli Kusterer wrote:
>  Well, what other communication mechanisms are there for talking between
>  sandboxed apps ... ? I *did* call it a last-ditch thing.

XPC and Apple Events (as long as your sdef uses access groups).

--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: Talking to other apps

2014-08-04 Thread Kevin Meaney

On 4 Aug 2014, at 22:49, Kyle Sluder  wrote:

> On Mon, Aug 4, 2014, at 04:17 PM, Uli Kusterer wrote:
>> Well, what other communication mechanisms are there for talking between
>> sandboxed apps ... ? I *did* call it a last-ditch thing.
> 
> XPC and Apple Events (as long as your sdef uses access groups).

There has been some discussion on the xpc forum in Core OS on devforums about 
inter application communication. I new I'd seen it somewhere.

https://devforums.apple.com/community/mac/coreos/xpc

The thread "Can I use NSXPCConnection between two desktop apps?" I think is 
most relevant as there is some discussion of different options.

Kevin



___

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

center-y constant animation won't animate

2014-08-04 Thread Rick Mann
I'm setting the constant of a center-y-in-container constraint in a [UIView 
animateWith…] block, but it doesn't animate; it just jumps to the offset 
location. Any idea what I might be doing wrong? The code is pretty 
straightforward…

https://pastee.org/edgsf

I tried calling -animateWithDuration directly, and enqueueing it on the main 
queue (as seen here). Same result.

Any help would be much appreciated.


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

Re: center-y constant animation won't animate

2014-08-04 Thread David Duncan

> On Aug 4, 2014, at 4:10 PM, Rick Mann  wrote:
> 
> I'm setting the constant of a center-y-in-container constraint in a [UIView 
> animateWith…] block, but it doesn't animate; it just jumps to the offset 
> location. Any idea what I might be doing wrong? The code is pretty 
> straightforward…
> 
>   https://pastee.org/edgsf

Constraints are like recipes for layout, they don’t perform the actual layout 
themselves. You need to force layout on the affected view (by calling 
-layoutIfNeeded on it) within the animation block to generate the animation.

> I tried calling -animateWithDuration directly, and enqueueing it on the main 
> queue (as seen here). Same result.
> 
> Any help would be much appreciated.
> 
> 
> -- 
> 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/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: center-y constant animation won't animate

2014-08-04 Thread Ken Thomases
On Aug 4, 2014, at 6:10 PM, Rick Mann  wrote:

> I'm setting the constant of a center-y-in-container constraint in a [UIView 
> animateWith…] block, but it doesn't animate; it just jumps to the offset 
> location. Any idea what I might be doing wrong? The code is pretty 
> straightforward…
> 
>   https://pastee.org/edgsf
> 
> I tried calling -animateWithDuration directly, and enqueueing it on the main 
> queue (as seen here). Same result.
> 
> Any help would be much appreciated.

There are two approaches, but I don't know if the second applies on iOS.

First, the way you did it, is to just set the constraint constant.  However, 
you then have to force layout.  The constraint itself is not being animated.  
The changes to the frames that are done within the animation group are.  So, 
you need to call [self layoutIfNeeded] within the animation group.

The second way is to animate the constraint itself.  In this case, you change 
the constant on the constraint's animator proxy, not directly on the 
constraint.  So, you'd do self.logoVerticalConstraint.animator.constant = 100.

Cheers,
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: center-y constant animation won't animate

2014-08-04 Thread Rick Mann
Ah, thank you.

On Aug 4, 2014, at 16:15 , David Duncan  wrote:

> 
>> On Aug 4, 2014, at 4:10 PM, Rick Mann  wrote:
>> 
>> I'm setting the constant of a center-y-in-container constraint in a [UIView 
>> animateWith…] block, but it doesn't animate; it just jumps to the offset 
>> location. Any idea what I might be doing wrong? The code is pretty 
>> straightforward…
>> 
>>  https://pastee.org/edgsf
> 
> Constraints are like recipes for layout, they don’t perform the actual layout 
> themselves. You need to force layout on the affected view (by calling 
> -layoutIfNeeded on it) within the animation block to generate the animation.
> 
>> I tried calling -animateWithDuration directly, and enqueueing it on the main 
>> queue (as seen here). Same result.
>> 
>> Any help would be much appreciated.
>> 
>> 
>> -- 
>> 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/david.duncan%40apple.com
>> 
>> This email sent to david.dun...@apple.com
> 
> --
> David Duncan
> 


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

Re: Talking to other apps

2014-08-04 Thread Roland King

> On 4 Aug 2014, at 2:54 pm, Gerriet M. Denkmann  wrote:
> 
> My app wants to talk to some app-friend. Like sending a string and getting 
> another string back. Or something slightly more complicated.
> 
> In the good old days I would have used Distributed Objects, but this seems to 
> be no longer the fashion. Xcode 6 does not provide any documentation about 
> this (or I can't find it).
> 
> So, what to do?
> NSPerformService (which also has the feel of not being well-loved), XPC, or 
> what else?
> 
> Gerriet.


It’s odd how it’s easier to get two public apps to talk to each other than it 
is to get two private ones to. 

I’d put them in the same app group (presuming they are sandboxed) and then 
either use a domain socket or set up a simple dropbox in the shared directory 
and use a long-running NSFilePresenter to listen for changes and 
NSFileCoordination to read/write files to it. I’ve used that rather simple 
method in a few places now and it’s been surprisingly successful. You just end 
up with a callback on a queue of your choice in your app, read the file and go 
on your way. 
___

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: Swift video/PDF files within the WWDC 2014 video list

2014-08-04 Thread sqwarqDev
There's also 

404_sd_Advanced Swift
404_hd_Advanced Swift

There's presumably a Session 405, but I can't find it. Anyone?


On 11 Jun 2014, at 21:35, Alex Zavatone  wrote:

> Here are the names of the videos on Swift from the WWDC 2014 section of 
> Apple.com
> 
> https://developer.apple.com/videos/wwdc/2014
> 
> 402_hd_introduction_to_swift.mov
> 402_introduction_to_swift.pdf
> 403_hd_intermediate_swift.mov
> 403_intermediate_swift.pdf
> 406_hd_integrating_swift_with_objective_c.mov
> 406_integrating_swift_with_objective_c.pdf
> 407_hd_swift_interoperability_in_depth.mov
> 407_swift_interoperability_in_depth.pdf
> 408_hd_swift_playgrounds.mov
> 408_swift_playgrounds.pdf
> 409_hd_introduction_to_lldb_and_the_swift_repl.mov
> 409_introduction_to_lldb_and_the_swift_repl.pdf
> 410_advanced_swift_debugging_in_lldb.pdf
> 410_hd_advanced_swift_debugging_in_lldb.mov
> 
> I've already found several of these very useful.
> 
> Cheers,
> - Alex Zavatone
> ___
> 
> 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/sqwarqdev%40icloud.com
> 
> This email sent to sqwarq...@icloud.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: Debugging Swift

2014-08-04 Thread James White
I'm experiencing the same things. As it's beta 1 I guess it's expected that 
it's going to be really buggy. I wrote a simple app the other day and i crashed 
xcode easily 50 times. I'm giving up on swift for now until the next beta where 
Im hoping Apple fixes a load of things.

Also remember it's still in development so any radars you open will help shape 
the language and tools. Ive already spotted a dozzen holes in the language that 
Apple has replied to saying they're looking into it for a future release.

On 12 Jun 2014, at 04:38, Cosmo  wrote:

> Is it just me, or is there something broken with debugging Swift in the Xcode 
> 6 beta? I am running into problems like: local variables that are within 
> scope not appearing in the debugger’s variables list; values for string 
> variables not being displayed; no summary for the Quicklook view when trying 
> to inspect a string; no support for “po” as far as I can tell, among other 
> things. Needless to say it makes it really difficult to adapt this new 
> language when I can’t see why things aren’t working as I expect. I assume 
> that others are experiencing the same thing, but it would nice to know if it 
> isn’t just something I’m doing wrong. I also assume that this is a beta 
> issue, and it would be really nice to hear from somebody who knows better 
> that this will improve soon. It would be nice to know there is light at the 
> end of the tunnel.
> ___
> 
> 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/jamie%40consolegfx.net
> 
> This email sent to ja...@consolegfx.net


___

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

Intercepting *all* keystrokes in NSView?

2014-08-04 Thread Alex Hall
Hello list,
I have a subclass of NSView that is set to be my window's first responder. It 
intercepts keystrokes by implementing keyUp: and performKeyEquivalent: but it 
doesn't do quite what I need.

I have to intercept as many keystrokes as I possibly can, including those bound 
to menu items or lower-level system calls. For instance, if the user presses 
cmd-q, I need to be able to intercept, and selectively block, that (no, 
implementing applicationShouldTerminate: won't do here, as this has to work for 
all menu items). Moreover, and this may be impossible, I want to intercept 
VoiceOver keystrokes. I know that VO keystrokes are intercepted well before my 
app can see them, which is normally a good thing since it means that they 
almost always work, no matter what an app is doing. In this case, though, it 
would be very helpful to be able to block them (part of the app is to train 
people on the use of VO, so I can't have them pressing incorrect keystrokes and 
not knowing what they did).

Anyway, the immediate concern for me is the menu items, and anything else I can 
intercept. I can have users disable VoiceOver if I have to, so catching VO 
keystrokes is secondary. Here's what I have so far:

-(void) keyUp:(NSEvent*) event{
if(! [self handleKeyUpAndKeyEquivalent:event]) [super keyUp:event];
}

-(BOOL) performKeyEquivalent:(NSEvent*) event{
[self handleKeyUpAndKeyEquivalent:event];
return NO;
return [super performKeyEquivalent:event];
}

-(BOOL) handleKeyUpAndKeyEquivalent:(NSEvent*) event{
NSLog(@"Key pressed: %hu. Modifiers: %lu. Character: %@.", [event 
keyCode], [event modifierFlags], [event charactersIgnoringModifiers]);
return [[self task] checkKeypress:event];
}

First, I know that second return statement in performKeyEquivalent: is never 
called. I was doing some testing, and I figured it couldn't hurt to leave the 
second return in there since it will never be called anyway. Second, that call 
to [[self task] checkKeypress:event] is simply giving a "task" class the event. 
The class checks to see if the event's key press is what it was looking for, 
and returns a boolean based on what it finds.

Everything works (well, basically) except those menu item hotkeys. I get a log 
of them, since my app logs every keystroke it detects, but they aren't stopped. 
If it matters, my UI is the default window, inside of whose view is my 
key-capturing NSView subclass instance, inside of which is a basic text field. 
Please let me know if you need any additional code snippets, and thank you in 
advance for any suggestions.


--
Have a great day,
Alex Hall
mehg...@icloud.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: Swift video/PDF files within the WWDC 2014 video list

2014-08-04 Thread Roland King
No 405. I think that session was a lab. 

The issue I’m having right now with Swift is I can’t keep up with it, no pun 
intended. It’s great that Apple is being so responsive developing Swift as the 
community puts in bug reports and comments, but I wish at this point I could 
forget everything I learned and go learn it all over again from scratch. 

> On 13 Jun 2014, at 9:36 pm, sqwarqDev  wrote:
> 
> There's also 
> 
> 404_sd_Advanced Swift
> 404_hd_Advanced Swift
> 
> There's presumably a Session 405, but I can't find it. Anyone?
> 
> 
> On 11 Jun 2014, at 21:35, Alex Zavatone  wrote:
> 
>> Here are the names of the videos on Swift from the WWDC 2014 section of 
>> Apple.com
>> 
>> https://developer.apple.com/videos/wwdc/2014
>> 
>> 402_hd_introduction_to_swift.mov
>> 402_introduction_to_swift.pdf
>> 403_hd_intermediate_swift.mov
>> 403_intermediate_swift.pdf
>> 406_hd_integrating_swift_with_objective_c.mov
>> 406_integrating_swift_with_objective_c.pdf
>> 407_hd_swift_interoperability_in_depth.mov
>> 407_swift_interoperability_in_depth.pdf
>> 408_hd_swift_playgrounds.mov
>> 408_swift_playgrounds.pdf
>> 409_hd_introduction_to_lldb_and_the_swift_repl.mov
>> 409_introduction_to_lldb_and_the_swift_repl.pdf
>> 410_advanced_swift_debugging_in_lldb.pdf
>> 410_hd_advanced_swift_debugging_in_lldb.mov
>> 
>> I've already found several of these very useful.
>> 
>> Cheers,
>> - Alex Zavatone
>> ___
>> 
>> 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/sqwarqdev%40icloud.com
>> 
>> This email sent to sqwarq...@icloud.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/rols%40rols.org
> 
> This email sent to r...@rols.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: Intercepting *all* keystrokes in NSView?

2014-08-04 Thread dangerwillrobinsondanger


> On 2014/05/29, at 13:57, Alex Hall  wrote:
> 
> Hello list,
> I have a subclass of NSView that is set to be my window's first responder. It 
> intercepts keystrokes by implementing keyUp: and performKeyEquivalent: but it 
> doesn't do quite what I need

You need to read the event programming guide and then read it again. 
Views don't receive all key events and they don't get first shot at them 
either. 

In short, you're going to want to look at either NSEvent's global or local 
monitor 
Or
CGEventTap

Most of what you do id the same either way. 

Biggest gotchas are that some key events are intercepted and handled at the 
IOKit level. (Media Keys)
And that Function and modifier keys are approached differently. 
And that arrow keys are numpad keys. 
And some keys exist on on some keyboard layouts and not others. Localized 
keyboards. 

Also carefully consider input methods, by intercepting events you can actually 
be intercepting them before they are converted to what the user intends with 
multistage input ( Japanese for example )
This may or may not be ok. 

Definitely be cautious in thinking in terms of key codes. 
Key codes by the way are mostly documented in Carbon headers but can be useful 
practically. 

It's not really well documented but there are a lot of responder methods that 
are part of the Cocoa text system that can enable a lot of customization. They 
also alleviate the sandbox issues that can arise with monitors and event taps. 
___

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: Intercepting *all* keystrokes in NSView?

2014-08-04 Thread Ken Thomases
On May 28, 2014, at 11:57 PM, Alex Hall  wrote:

> -(BOOL) performKeyEquivalent:(NSEvent*) event{
>   [self handleKeyUpAndKeyEquivalent:event];
>   return NO;
>   return [super performKeyEquivalent:event];
> }

> Everything works (well, basically) except those menu item hotkeys. I get a 
> log of them, since my app logs every keystroke it detects, but they aren't 
> stopped.

If you want to "stop" the menu item hotkeys, why are you not returning YES from 
-performKeyEquivalent:?

But, as mentioned, your best bet for getting as many key events as possible is 
an event tap.

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

Problem with getting access to fields of Core Data model

2014-08-04 Thread Ronald Hofmann
See My code below.
This works so far if I only use the field password for output. See line "Here 
is the problem"

When changing to this instead, which should work in my opinion, I get Errors: 
txtGesamt.text = txtGesamt.text + "\(res.username), \(res.password)  \n"

/Users/ronny/Dropbox/CoreDataYouTube/vcMain.swift:73:16: 'AnyObject' does not 
have a member named 'username'

What I don´t understand. If res.password is correct  res.username should work 
as well.
What am I doing wrong? Any idea?

Greetings from Switzerland, Ronald Hofmann
---  

My code:
func btnLoadWrapper ( myFlag: Bool ) {

var appDel :AppDelegate = (UIApplication.sharedApplication().delegate 
as AppDelegate )
var context:NSManagedObjectContext = appDel.managedObjectContext

var request = NSFetchRequest(entityName: "Users")
request.returnsObjectsAsFaults = false

txtGesamt.text   = ""   






// clearing UITextView

request.predicate = NSPredicate (format: "username = 
%@",txtUsername.text)

var results:NSArray = context.executeFetchRequest(request, error: nil)

if(results.count > 0) { 

for res in results {
//Writing the contents into UITextView txtGesamt

println("\(res)")   
//returns result 1
Here is the problem txtGesamt.text = txtGesamt.text + 
"\(res.password)  \n" //see result 2
}
}
}


result 1
 (entity: Users; id: 0xd080 
> ; data: {
password = MyPassword;
reference = Gargantua20;
username = EuroMillions;

result 2 appear in txtGesamt (these passwords actually change)
MyPassword
MyPassword
.
.
.

___

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