Re: Proper way to set up constants when building an iOS framework

2016-04-19 Thread Alex Zavatone
On Apr 18, 2016, at 6:13 PM, Jens Alfke wrote: > >> On Apr 18, 2016, at 2:03 PM, Alex Zavatone wrote: >> >>> Is Constants.h in the framework’s Headers directory, next to the main >>> framework header file? >> >> Where in the project? In target framework's Build Phases Headers section? > >

Re: Proper way to set up constants when building an iOS framework

2016-04-19 Thread Alex Zavatone
On Apr 16, 2016, at 7:19 AM, Uli Kusterer wrote: > A precompiled prefix header is a compile-time construct that only applies to > the interior of your framework. You can't really tell people linking to your > framework to add a certain prefix header. So you can use a pch for actually > writing

Re: BOOL parameter passed as nil object

2016-04-19 Thread Alex Zavatone
I believe that a BOOL can only be YES or NO. A nil value on a BOOL would be NO if I am correct. Am I correct here? On Apr 18, 2016, at 9:56 PM, Carl Hoefs wrote: > Suppose I have an object with a declared method signature: > -(void)myMethod:(BOOL)a_bool; > > Q1: If I invoke it like this: >

Re: BOOL parameter passed as nil object

2016-04-19 Thread Greg Parker
> On Apr 18, 2016, at 6:56 PM, Carl Hoefs > wrote: > > Suppose I have an object with a declared method signature: > -(void)myMethod:(BOOL)a_bool; > > Q1: If I invoke it like this: > [self performSelector:@selector(myMethod:) withObject:nil]; // nil obj > Will argument a_bool end up with a 0

Re: Proper way to set up constants when building an iOS framework

2016-04-19 Thread Jens Alfke
> On Apr 19, 2016, at 10:20 AM, Alex Zavatone wrote: > > So, since we have to create a constants file in a framework with .h and .m > files, I've never seen a .m compliment to a .pch. I have no idea how this > would work at all or how I would be able to set this up. I’m not sure why you keep

Re: Proper way to set up constants when building an iOS framework

2016-04-19 Thread Gary L. Wade
Another thing I do is add FOUNDATION_EXPORT before my constants in headers, which will give you the right stuff whether C or C++; C++ name mangling is a common reason for odd link errors if you include a header in a C++/Objective-C++ source file. I'm sure you can find examples of this in open s

Re: Proper way to set up constants when building an iOS framework

2016-04-19 Thread Alex Zavatone
On Apr 19, 2016, at 1:38 PM, Gary L. Wade wrote: > Another thing I do is add FOUNDATION_EXPORT before my constants in headers, > which will give you the right stuff whether C or C++; C++ name mangling is a > common reason for odd link errors if you include a header in a > C++/Objective-C++ sou

Re: Proper way to set up constants when building an iOS framework

2016-04-19 Thread Gary L. Wade
In a Terminal window, start off with this command: find /Applications/Xcode.app/Contents/Developer/Platforms -type f -print0 | xargs -0 grep FOUNDATION_EXPORT Then go to opensource.apple.com and look around. Note those are zeros, not capital O's if you type the command out vs copy/paste. -- Gar

Re: Proper way to set up constants when building an iOS framework

2016-04-19 Thread Alex Zavatone
On Apr 19, 2016, at 1:35 PM, Jens Alfke wrote: > >> On Apr 19, 2016, at 10:20 AM, Alex Zavatone wrote: >> >> So, since we have to create a constants file in a framework with .h and .m >> files, I've never seen a .m compliment to a .pch. I have no idea how this >> would work at all or how I

Re: Proper way to set up constants when building an iOS framework

2016-04-19 Thread Alex Zavatone
On Apr 19, 2016, at 2:18 PM, Gary L. Wade wrote: > In a Terminal window, start off with this command: > > find /Applications/Xcode.app/Contents/Developer/Platforms -type f -print0 | > xargs -0 grep FOUNDATION_EXPORT If this would expose my constants outside my framework, this is what I do not

Re: Proper way to set up constants when building an iOS framework

2016-04-19 Thread Quincey Morris
On Apr 19, 2016, at 11:27 , Alex Zavatone wrote: > > Sorry this is going on so long, but all I'm looking for is to set up a simple > constants file that works in a framework (and only for my framework) just the > same manner they work within an iOS app. You have the answer already, but you did

Re: Proper way to set up constants when building an iOS framework

2016-04-19 Thread Quincey Morris
On Apr 19, 2016, at 11:41 , Quincey Morris wrote: > > There is a build setting for “Prefix Header” […] Sorry, after I posted, I realized my description was a bit fuzzy. To clarify: — There is a per-target build setting that specifies the *name* of the prefix header, typically with a .pch exte

Re: Proper way to set up constants when building an iOS framework

2016-04-19 Thread Jens Alfke
> On Apr 19, 2016, at 10:13 AM, Alex Zavatone wrote: > > No. I'm simply trying to find out how to make my constants.h (which has the > constants.m as well) visible to all of the classes in my framework, just as > the .pch would be visible to all of the classes within an iOS app. Add #import

Re: BOOL parameter passed as nil object

2016-04-19 Thread Jens Alfke
> On Apr 19, 2016, at 10:22 AM, Alex Zavatone wrote: > > I believe that a BOOL can only be YES or NO. A nil value on a BOOL would be > NO if I am correct. At the language level, yes. The problem is, this behavior is occurring at runtime, at the machine-code level. The delayed-perform implem

Re: Proper way to set up constants when building an iOS framework

2016-04-19 Thread Ben Kennedy
> On 19 Apr 2016, at 11:41 am, Quincey Morris > wrote: > > The (built) precompiled header files does *not* have extension “.pch”, While a trivial detail, this does not seem to be true (at least in Xcode 7.2). We have a prefix header called "Kashoo_Prefix.pch", and if I hit cmd-shift-O and ty

Re: BOOL parameter passed as nil object

2016-04-19 Thread Greg Parker
> On Apr 19, 2016, at 12:07 PM, Jens Alfke wrote: > >> On Apr 19, 2016, at 10:22 AM, Alex Zavatone wrote: >> >> I believe that a BOOL can only be YES or NO. A nil value on a BOOL would be >> NO if I am correct. > > At the language level, yes. Not even there. On some platforms BOOL is defi

Re: Proper way to set up constants when building an iOS framework

2016-04-19 Thread Quincey Morris
On Apr 19, 2016, at 12:14 , Ben Kennedy wrote: > > While a trivial detail, this does not seem to be true (at least in Xcode > 7.2). We have a prefix header called "Kashoo_Prefix.pch", and if I hit > cmd-shift-O and type that string, I get a pile of results: first the source > prefix file, then

Re: Proper way to set up constants when building an iOS framework

2016-04-19 Thread Jens Alfke
> On Apr 19, 2016, at 11:19 AM, Alex Zavatone wrote: > > How might I create one that the framework knows how to use? Should I create > some .pch, then include the constants.h in it? If so, once I create the > .pch, where is the setting to tell my framework that it needs to use it? OH. Now I

Re: BOOL parameter passed as nil object

2016-04-19 Thread Alex Zavatone
On Apr 19, 2016, at 3:23 PM, Greg Parker wrote: > >> On Apr 19, 2016, at 12:07 PM, Jens Alfke wrote: >> >>> On Apr 19, 2016, at 10:22 AM, Alex Zavatone wrote: >>> >>> I believe that a BOOL can only be YES or NO. A nil value on a BOOL would >>> be NO if I am correct. >> >> At the language

Re: BOOL parameter passed as nil object

2016-04-19 Thread Charles Srstka
> On Apr 19, 2016, at 2:07 PM, Jens Alfke wrote: > > Anyway, I can’t remember if anyone gave a solution to the question. The right > way to do this is to create a new method that takes an NSNumber, and invoke > _that_ method using the delayed-perform, after boxing the BOOL. Then the new > meth

Re: BOOL parameter passed as nil object

2016-04-19 Thread John McCall
> On Apr 19, 2016, at 1:20 PM, Alex Zavatone wrote: > On Apr 19, 2016, at 3:23 PM, Greg Parker wrote: > >> >>> On Apr 19, 2016, at 12:07 PM, Jens Alfke wrote: >>> On Apr 19, 2016, at 10:22 AM, Alex Zavatone wrote: I believe that a BOOL can only be YES or NO. A nil value on a

How to make an app launch on login?

2016-04-19 Thread Jens Alfke
One of my companies’ apps has a “Launch at login” pref, which no longer works in OS X 10.11. I’m not surprised, since the existing code implements this by writing into loginwindow’s user defaults :-p I’m trying to find the currently supported API for this. The “Adding Login Items” page says: >

Re: How to make an app launch on login?

2016-04-19 Thread Jeff Szuhay
There was some discussion of this on stack overflow but one of the APIs there is deprecated: LSSharedFileListItemResolve. It’s 3rd parameter takes a pointer to a CFURLRef and that is now deprecated. Instead, use LSSharedFileListItemCopyResolveURL; basically the return value from this is what you

Re: How to make an app launch on login?

2016-04-19 Thread Jeff Szuhay
I spoke too soon; yes, all of this is marked as “available but deprecated on 10.11”. I would hope that Apple would provide sample code to show the preferred new way to do this. > On Apr 19, 2016, at 2:29 PM, Jeff Szuhay wrote: > > There was some discussion of this on stack overflow but one

Re: How to make an app launch on login?

2016-04-19 Thread Jens Alfke
> On Apr 19, 2016, at 2:35 PM, Jeff Szuhay wrote: > > I spoke too soon; yes, all of this is marked as “available but deprecated on > 10.11”. Yeah, interesting that Apple added LSSharedFileListItemCopyResolveURL in 10.10 and then deprecated it in 10.11. Oops! I guess I’ll use this API anyway

Re: How to make an app launch on login?

2016-04-19 Thread Jeff Szuhay
Again, I jumped the gun. The preferred way seems to be through the use of launchd

Re: How to make an app launch on login?

2016-04-19 Thread Jens Alfke
> On Apr 19, 2016, at 2:43 PM, Jeff Szuhay wrote: > > The preferred way seems to be through the use of launchd I don’t think so. I’ve worked with launchd before — it provides very low-level functionality for starting background processes, and there’s no visible UI for configuring it. Not at a

No Alert, Discard Change, & Beep

2016-04-19 Thread Richard Charles
I have a NSTextField with a NSFormatter. When the user enters an incorrect value an alert sheet drops down from the document window stating “Please provide a valid value.”. The alert display two buttons: "Discard Change" and “OK”. I would like have no alert sheet but rather discard the change a

Re: BOOL parameter passed as nil object

2016-04-19 Thread Scott Ribe
On Apr 19, 2016, at 2:20 PM, Alex Zavatone wrote: > > Considering its use at the language level, would values of nil and 0 result > as NO and every other value of 1 or > == YES? No, when it's a char, there are 254 values which are not == to either NO or YES. This can be a pretty severe trap fo

Re: No Alert, Discard Change, & Beep

2016-04-19 Thread Quincey Morris
On Apr 19, 2016, at 16:11 , Richard Charles wrote: > > I have a NSTextField with a NSFormatter. When the user enters an incorrect > value an alert sheet drops down from the document window stating “Please > provide a valid value.”. Is the text field bound to a NSObjectController, or how does i

Re: No Alert, Discard Change, & Beep

2016-04-19 Thread Richard Charles
> On Apr 19, 2016, at 5:28 PM, Quincey Morris > wrote: > > On Apr 19, 2016, at 16:11 , Richard Charles wrote: >> >> I have a NSTextField with a NSFormatter. When the user enters an incorrect >> value an alert sheet drops down from the document window stating “Please >> provide a valid value

Re: No Alert, Discard Change, & Beep

2016-04-19 Thread Quincey Morris
On Apr 19, 2016, at 22:25 , Richard Charles wrote: > > I am not sure where the alert sheet comes from but … I just looked this up here: https://developer.apple.com/library/mac/documentation/Cocoa/Conceptual/CocoaBindings/Concepts/MessageFlow.html

Re: No Alert, Discard Change, & Beep

2016-04-19 Thread Richard Charles
> On Apr 19, 2016, at 11:52 PM, Quincey Morris > wrote: > > On Apr 19, 2016, at 22:25 , Richard Charles wrote: >> >> I am not sure where the alert sheet comes from but … > > I just looked this up here: > > > https://developer.apple.com/library/mac/documentation/Cocoa/Conceptual/Cocoa