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/CocoaBindings/Concepts/MessageFlow.html
> 
> under the heading "User Updates a Value in the User Interface”. This picture 
> dates back to OS X 10.5, but it’s still accurate AFAIK — which is an 
> indication of the last time bindings functionality was … er … improved, or 
> even changed, really. According to this, the NSFormatter validation happens 
> very early. (If you ever feel you’ve grasped OS X, this is a good page to 
> prove you wrong. ;) )

The engineers at Apple that invented and implemented this stuff must have been 
amazing.

> One alternative solution is to use a “captive” NSFormatter. That is, take it 
> off the text field in IB, and create one in code. Then implement the KVC 
> validate method to apply the formatter yourself, and deal with the 
> formatting failure however you want.

Actually I don’t do anything in IB, it is all done programmatically for various 
reasons. I have a fairly complex NSFormatter subclass. My NSTextField subclass 
also has some unique functionality.

> To do this, you could create a KVO-compliant derived NSString property in 
> (say) your view or window controller, and bind the naked text field to that 
> instead.

I will need to think about that.

> It’s more work than you’ve done (and you have to figure out the quirky 
> validate API) but it gives you more control about what you do when the 
> input is invalid, and what you change the invalid field back to. I mention 
> this because beeping is only a marginally less crappy UI than the one you’re 
> trying to avoid.

Actually a beep is not all that bad. But then again it depends on how often 
your computer is beeping. I worked at a place once where there was a room full 
of engineers all working on Macs. One particular engineer did not like working 
on a Mac, as a matter of fact he hated Macs. His computer was beeping all the 
time. He eventually got a PC to work on but the quality of his work never 
really did improve.

I think a great way to learn an app would be for a vendor to provide targeted 
training videos. Some of these exist on youtube but most of them that I have 
watched have been created by a third party. No one likes to read a manual 
anymore and the Help menu has rarely been of help to me when I needed help.

So onward and upward, a beep it is!

--Richard Charles


___

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


under the heading "User Updates a Value in the User Interface”. This picture 
dates back to OS X 10.5, but it’s still accurate AFAIK — which is an indication 
of the last time bindings functionality was … er … improved, or even changed, 
really. According to this, the NSFormatter validation happens very early. (If 
you ever feel you’ve grasped OS X, this is a good page to prove you wrong. ;) )

One alternative solution is to use a “captive” NSFormatter. That is, take it 
off the text field in IB, and create one in code. Then implement the KVC 
validate method to apply the formatter yourself, and deal with the 
formatting failure however you want.

To do this, you could create a KVO-compliant derived NSString property in (say) 
your view or window controller, and bind the naked text field to that instead.

It’s more work than you’ve done (and you have to figure out the quirky 
validate API) but it gives you more control about what you do when the 
input is invalid, and what you change the invalid field back to. I mention this 
because beeping is only a marginally less crappy UI than the one you’re trying 
to avoid.


___

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: 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.”.
> 
> Is the text field bound to a NSObjectController, or how does it get/set its 
> value from/to the data model?

Yes, the text field is bound to an NSArrayController.

> My memory is vague on this, but I think that obnoxious sheet comes from the 
> NSObjectController rather than the NSFormatter.

I am not sure where the alert sheet comes from but I discovered it uses the 
responder chain. After much trial and error the following NSResponder override 
seems to work well in my NSTextField subclass.

- (void)presentError:(NSError *)error modalForWindow:(NSWindow *)window 
delegate:(id)delegate didPresentSelector:(SEL)didPresentSelector 
contextInfo:(void *)contextInfo
{
NSBeep();
[self abortEditing];
[self.window makeFirstResponder:self];
}

The default implementation of this method presents an error alert to the user 
as a document-modal sheet attached to the document window. Instead we simply 
beep, abort editing, and reset the text field for editing again.

The documentation cautions against overriding this method but I could not find 
anything else that worked.

--Richard Charles


___

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: 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 it get/set its 
value from/to the data model?

My memory is vague on this, but I think that obnoxious sheet comes from the 
NSObjectController rather than the NSFormatter.

___

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: 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 for the unaware. (Especially the part 
where multiples of 256 can become == NO...)

When it's a proper C99'ish bool, then all values are cast to bool at 
assignment, and so it is always == either 0 or 1.


-- 
Scott Ribe
scott_r...@elevated-dev.com
http://www.elevated-dev.com/
https://www.linkedin.com/in/scottribe/
(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

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 and beep. You 
can see this behavior in some inspector text fields of Apple Productivity Apps 
(Numbers, Pages, etc).

A NSTextFieldDelegate method has been implemented like so.

- (BOOL)control:(NSControl *)control didFailToFormatString:(NSString *)string 
errorDescription:(NSString *)error
{
NSBeep();
return NO;
}

This gives a beep but how is the alert sheet suppressed and the change 
discarded?

Does anyone know how to do this?

--Richard Charles


___

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: 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 all the same thing as launching apps at login.

—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: 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
 
>?



>>> On Apr 19, 2016, at 2:01 PM, Jens Alfke  wrote:
>>> 
>>> 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

___

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: 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 since it’s the best thing I can find. Thanks!

—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: 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 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 want.
> 
> Deprecated:
>   if( LSSharedFileListItemResolve( itemRef , 0 , (CFURLRef*) &thePath , 
> NULL ) == NoErr )
> 
> Accepted:
>   thePath = LSSharedFileListItemCopyResolveURL( itemRef, 0 , NULL)
>   if( thePath ) 
> 
> It looks to me like this was done to have a single API for both Swift and 
> Obj-C for less maintenance (makes sense).
> 
> 
>> On Apr 19, 2016, at 2:01 PM, Jens Alfke  wrote:
>> 
>> 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:
>>> There are two ways to add a login item: using the Service Management 
>>> framework, and using a shared file list.
>>> Login items installed using the Service Management framework are not 
>>> visible in System Preferences and can only be removed by the application 
>>> that installed them.
>>> Login items installed using a shared file list are visible in System 
>>> Preferences; users have direct control over them. 
>> 
>> I’d definitely prefer the latter, since it seems like a bad idea to have the 
>> app not show up in the user’s login-item list in the Accounts system pref.
>> 
>> I found LSSharedFileList.h, but everything in there is marked deprecated. :(
>> 
>> What are my options?
>> 
>> —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: 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 want.

Deprecated:
if( LSSharedFileListItemResolve( itemRef , 0 , (CFURLRef*) &thePath , 
NULL ) == NoErr )

Accepted:
thePath = LSSharedFileListItemCopyResolveURL( itemRef, 0 , NULL)
if( thePath ) 

It looks to me like this was done to have a single API for both Swift and Obj-C 
for less maintenance (makes sense).


> On Apr 19, 2016, at 2:01 PM, Jens Alfke  wrote:
> 
> 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:
>> There are two ways to add a login item: using the Service Management 
>> framework, and using a shared file list.
>> Login items installed using the Service Management framework are not visible 
>> in System Preferences and can only be removed by the application that 
>> installed them.
>> Login items installed using a shared file list are visible in System 
>> Preferences; users have direct control over them. 
> 
> I’d definitely prefer the latter, since it seems like a bad idea to have the 
> app not show up in the user’s login-item list in the Accounts system pref.
> 
> I found LSSharedFileList.h, but everything in there is marked deprecated. :(
> 
> What are my options?
> 
> —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/jeff%40szuhay.org
> 
> This email sent to j...@szuhay.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

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:
> There are two ways to add a login item: using the Service Management 
> framework, and using a shared file list.
> Login items installed using the Service Management framework are not visible 
> in System Preferences and can only be removed by the application that 
> installed them.
> Login items installed using a shared file list are visible in System 
> Preferences; users have direct control over them. 

I’d definitely prefer the latter, since it seems like a bad idea to have the 
app not show up in the user’s login-item list in the Accounts system pref.

I found LSSharedFileList.h, but everything in there is marked deprecated. :(

What are my options?

—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: 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 BOOL would 
 be NO if I am correct. 
>>> 
>>> At the language level, yes.
>> 
>> Not even there. On some platforms BOOL is defined as signed char. It may 
>> have any of 254 values other than YES or NO.
> 
> IIRC from when I was playing with the runtime, Isn't our friend the BOOL 
> backed by a char in Obj-C?  

Greg answered this already.  Sometimes it's signed char, sometimes it's C99 
_Bool / C++ bool.  It's platform-dependent.

> Considering its use at the language level, would values of nil and 0 result 
> as NO and every other value of 1 or > == YES?

Passing a value of pointer type and then receiving it as a value of type BOOL 
is not guaranteed to work in the calling convention, full stop.  It can 
arbitrarily misbehave.

On current Apple platforms, they will both generally be passed in a roughly 
equivalent way on the "physical" level: i.e. in a pointer-sized register or 
chunk of stack space.  So on the most primitive level, it will "work" in the 
sense that it will not e.g. leave the stack misaligned or cause later arguments 
to be misinterpreted.

However, a pointer value will generally not satisfy the requirements of a BOOL 
argument.  For example, on some platforms, when a 'signed char' argument is 
passed in a register, it must first be sign-extended:, and the callee may 
assume that the high bits will be all-zeroes or all-ones.  Similarly, the 
callee may assume that a _Bool argument will be either 0 or 1; whether that's a 
guarantee for the entire register or just the low 8 bits is also 
target-dependent.  So nil may satisfy the representation rules for NO, but a 
non-nil pointer will usually violate the representation rules and may result in 
unreliable behavior in practice.

Plus, of course, even if it all works out on these primitive levels, it's still 
actually undefined behavior in the end, and so the compiler reserves the right 
to find a way to miscompile your program.

We strongly encourage you not to worry about any of this and just always call 
methods using the right method signature.

John.
___

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: 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 
> method can call the original method with the unboxed BOOL value.

Or, use NSInvocation:

BOOL someBool = …;

SEL selector = @selector(myMethod:);
NSMethodSignature *sig = [self methodSignatureForSelector:selector];
NSInvocation *invocation = [NSInvocation invocationWithMethodSignature:sig];

[invocation setArgument:&someBool atIndex:2];
[invocation invokeWithTarget:self];

Not pretty, but it works.

The *best* solution is probably to see if there’s a way to move away from 
performSelector: in the first place, possibly by moving towards a blocks-based 
approach. This is more future-proof, too, since a lot of this Obj-C dynamic 
stuff isn’t available in Swift, so you’ll have to redesign it all if you decide 
to go that direction at some point.

Charles

___

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: 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 level, yes.
> 
> Not even there. On some platforms BOOL is defined as signed char. It may have 
> any of 254 values other than YES or NO.

IIRC from when I was playing with the runtime, Isn't our friend the BOOL backed 
by a char in Obj-C?  

Considering its use at the language level, would values of nil and 0 result as 
NO and every other value of 1 or > == YES?



___

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: 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 understand what’s going wrong — you’re actually asking how to set up 
a prefix header for a target.

Make a .pch file. Enter something like
#import 
#import "Constants.h"
Go to the target build settings. 
Use the filter field to search for “prefix header” (it’s under “Apple LLVM - 
Language”). *
Set the value to the path to your .pch file (relative to the project directory).
You probably want to enable Precompile Prefix Header.

—Jens

* The target might already have a prefix header set. In that case you can just 
edit that one instead. Or delete it and set the path to your own.
___

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: 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 about a dozen other non-text files named 
> "Kashoo_Prefix.pch.pch" that exist within various subdirectories of the build 
> folder.

Ah, yes, I see that too. However, I don’t think these are the precompiled files 
— mine is only 173KB, which seems awfully small for all of Cocoa plus other 
stuff — but perhaps they’re references (bookmarks? aliases?) to the precompiled 
files. I suspect that the implementation details are different now because of 
the use of modules, which overlap and/or replace the old precompilation 
behavior.

So, I stand corrected. I should have just said that the prefix file 
conventionally has a .pch extension (for historical reasons, indicating its 
relationship to a possible precompiled header file), and left it at that.

___

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: 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 defined as signed char. It may have 
any of 254 values other than YES or NO.


-- 
Greg Parker gpar...@apple.com Runtime Wrangler



___

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: 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 type that string, I get a pile of results: first the source prefix file, 
then about a dozen other non-text files named "Kashoo_Prefix.pch.pch" that 
exist within various subdirectories of the build folder.

b


___

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: 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 implementation is going 
to call the method as though it takes an object pointer as a parameter. But the 
implementation of the method takes a BOOL as a parameter.

This is the sort of situation where the C standard throws up its hands and says 
“undefined behavior”, because what happens depends on the details of how 
parameters are passed to functions at the machine level. Are they passed in 
registers or on the stack? If on the stack, how are they sized or aligned?

It’s kind of as though you gave the computer a washer, convinced it it’s a 
quarter, and told it to buy you a coke. What happens when the computer shoves 
the washer into the vending machine? Will the machine accept it, or will it 
jam, or will it blow up? We really just don’t know.

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 
method can call the original method with the unboxed BOOL value.

—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: 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 “constants.h” to the .pch file of the framework target.

—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: 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 extension.

— There is a prefix header file of this name, which belongs to the project, 
just like other source files.

— The contents of the prefix header file is source code, typically #import 
statements such as #import constants.h.

___

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: 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 didn’t recognize it as it whizzed by.

There is a build setting for “Prefix Header”, which is a header file (like a 
normal .h file) that contains #import and #include statements (and possibly 
other source such as #if, #define, and even declarations). This header file is 
included at the start of every compilation for the target using these build 
settings. So, to get constants.h included in every compilation for the 
framework, add "#import constants.h” to your prefix header for the framework’s 
build settings.

The convention is that this header file has a “.pch” extension rather than 
“.h”, for historical reasons. But it’s just a source file, and you can filter 
your build settings with “prefix” to find it easily.

[Separately, it’s possible to *precompile* this into a “precompiled header 
file” — hence the “.pch” extension for the source, but this is an optimization 
detail, controlled by a different build setting. The (built) precompiled header 
files does *not* have extension “.pch”, and it’s not even in the derived data 
for the project, because it can be shared between projects. Again, the 
recompilation aspect is a different issue.]

Also, when you have a prefix header (.pch), it’s typical for this to be 
available in the list of files belonging to your project, in the project 
navigator on the left of the Xcode window. That makes it easy to bring up the 
file for editing. In the past, this was present when your target was created 
from an Xcode template, but if it’s not there in the framework target, you can 
add it yourself.

___

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: 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 
want.

I'm simply trying to get all my classes within my framework to see the 
constants without having to import the constants.h file in every single class 
of my framework.

I'd like to import my constants from 1 file within my framework and have all 
classes of my framework be able to see and use the constants.

Just like how we would do it within an app.

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.

Currently, I have not been able to locate any resource that explains how to 
import the constants into 1 file (within its own framework) and expose the 
constants to all the classes of that framework.

FYI, I'm building this framework.  That's why I want the constants to apply to 
this framework.

Thanks.

> 
> 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.
> --
> Gary L. Wade (Sent from my iPhone)
> http://www.garywade.com/
> 
>> On Apr 19, 2016, at 11:11 AM, Alex Zavatone  wrote:
>> 
>> 
>>> 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++ source file.
>>> 
>>> I'm sure you can find examples of this in open source, and Apple's own open 
>>> source has these, too. If something isn't working, you're better off 
>>> showing concrete examples from here on out.
>>> --
>>> Gary L. Wade (Sent from my iPhone)
>>> http://www.garywade.com/
>> 
>> I've looked all around for this, have been pulled of on to other projects 
>> and am back trying to get this to work.  I can't find this explained 
>> anywhere.
>> 
 On Apr 19, 2016, at 10:20 AM, Alex Zavatone  wrote:
 
 
> 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 the framework implementation,
 
 That is all I am trying to accomplish.
 
 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.
 
 What I am trying to achieve is simply declare constants for all my classes 
 within a framework (and only for the framework) and do it in one spot.  
 
 It is my understanding that in a framework we need .h and .m files to 
 declare the constants and I have set these up.
 
 Now, I am trying to get this constants.m imported in one area that will 
 allow every class within my framework to have access to them.
 
 Thanks, Uli.
>> 
> 


___

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: 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 would be able to set this up.
> 
> I’m not sure why you keep bring up .pch files — they really have nothing to 
> do with frameworks. A prefix header is simply a convenience that 
> automatically #imports a header before compiling every source file in a 
> target.

Because that type of functionality is what I want to be able to have for all 
the classes inside my framework.  

That's EXACTLY what I want,.  It is the example of the functionality li desire.

> 
> If you want every source file in your app to import the framework’s header, 
> then just add #import  to the app target’s existing 
> .pch.

You're misunderstanding what I'm asking for.  I need the framework's internal 
classes to be able to see all the constants defined in constants.h and 
constants.m without me importing the constants.h file in every class within my 
framework.

I don't care about what the app that links to my framework sees.  I'd prefer 
that the app that uses the framework NOT have access to the internals.

> 
> If you want the source files in the framework to have access to some header, 
> then just include the header in the framework’s .pch.

There is no framework .pch.

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?

> 
>> Now, I am trying to get this constants.m imported in one area that will 
>> allow every class within my framework to have access to them.
> 
> You don’t import .m files; they’re not headers. Compile the .m file into the 
> framework and the constants will be part of the framework. Then the 
> framework, and any code linking with it, gets the definitions of the 
> constants.

Oops.  My mistake typing constants.m.  Sorry.

> 
> —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: 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.
--
Gary L. Wade (Sent from my iPhone)
http://www.garywade.com/

> On Apr 19, 2016, at 11:11 AM, Alex Zavatone  wrote:
> 
> 
>> 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++ source file.
>> 
>> I'm sure you can find examples of this in open source, and Apple's own open 
>> source has these, too. If something isn't working, you're better off showing 
>> concrete examples from here on out.
>> --
>> Gary L. Wade (Sent from my iPhone)
>> http://www.garywade.com/
> 
> I've looked all around for this, have been pulled of on to other projects and 
> am back trying to get this to work.  I can't find this explained anywhere.
> 
>>> On Apr 19, 2016, at 10:20 AM, Alex Zavatone  wrote:
>>> 
>>> 
 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 the framework implementation,
>>> 
>>> That is all I am trying to accomplish.
>>> 
>>> 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.
>>> 
>>> What I am trying to achieve is simply declare constants for all my classes 
>>> within a framework (and only for the framework) and do it in one spot.  
>>> 
>>> It is my understanding that in a framework we need .h and .m files to 
>>> declare the constants and I have set these up.
>>> 
>>> Now, I am trying to get this constants.m imported in one area that will 
>>> allow every class within my framework to have access to them.
>>> 
>>> Thanks, Uli.
> 


___

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: 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++ source file.
> 
> I'm sure you can find examples of this in open source, and Apple's own open 
> source has these, too. If something isn't working, you're better off showing 
> concrete examples from here on out.
> --
> Gary L. Wade (Sent from my iPhone)
> http://www.garywade.com/
> 

I've looked all around for this, have been pulled of on to other projects and 
am back trying to get this to work.  I can't find this explained anywhere.

>> On Apr 19, 2016, at 10:20 AM, Alex Zavatone  wrote:
>> 
>> 
>>> 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 the framework implementation,
>> 
>> That is all I am trying to accomplish.
>> 
>> 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.
>> 
>> What I am trying to achieve is simply declare constants for all my classes 
>> within a framework (and only for the framework) and do it in one spot.  
>> 
>> It is my understanding that in a framework we need .h and .m files to 
>> declare the constants and I have set these up.
>> 
>> Now, I am trying to get this constants.m imported in one area that will 
>> allow every class within my framework to have access to them.
>> 
>> Thanks, Uli.
> 


___

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: 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 source, and Apple's own open 
source has these, too. If something isn't working, you're better off showing 
concrete examples from here on out.
--
Gary L. Wade (Sent from my iPhone)
http://www.garywade.com/

> On Apr 19, 2016, at 10:20 AM, Alex Zavatone  wrote:
> 
> 
>> 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 the framework implementation,
> 
> That is all I am trying to accomplish.
> 
> 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.
> 
> What I am trying to achieve is simply declare constants for all my classes 
> within a framework (and only for the framework) and do it in one spot.  
> 
> It is my understanding that in a framework we need .h and .m files to declare 
> the constants and I have set these up.
> 
> Now, I am trying to get this constants.m imported in one area that will allow 
> every class within my framework to have access to them.
> 
> Thanks, Uli.


___

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: 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 bring up .pch files — they really have nothing to do 
with frameworks. A prefix header is simply a convenience that automatically 
#imports a header before compiling every source file in a target.

If you want every source file in your app to import the framework’s header, 
then just add #import  to the app target’s existing .pch.

If you want the source files in the framework to have access to some header, 
then just include the header in the framework’s .pch.

> Now, I am trying to get this constants.m imported in one area that will allow 
> every class within my framework to have access to them.

You don’t import .m files; they’re not headers. Compile the .m file into the 
framework and the constants will be part of the framework. Then the framework, 
and any code linking with it, gets the definitions of the constants.

—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: 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 value assigned to it?

Don't do that. The behavior is undefined. It probably happens to work on all 
current architectures.


> Q2: But if I invoke it like this:
>  [self performSelector:@selector(myMethod:) withObject:someObj];  // valid obj
> Will argument a_bool end up with a 1 value assigned to it?

Don't do that. The behavior is undefined. It will certainly fail on some 
current architectures at least some of the time.

You should not use -performSelector:withObject: to call methods that use 
non-object parameters.


-- 
Greg Parker gpar...@apple.com Runtime Wrangler



___

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: 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:
>  [self performSelector:@selector(myMethod:) withObject:nil];  // nil obj
> Will argument a_bool end up with a 0 value assigned to it?
> 
> Q2: But if I invoke it like this:
>  [self performSelector:@selector(myMethod:) withObject:someObj];  // valid obj
> Will argument a_bool end up with a 1 value assigned to it?
> 
> -Carl
> 
> 
> ___
> 
> 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

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 the framework implementation,

That is all I am trying to accomplish.

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.

What I am trying to achieve is simply declare constants for all my classes 
within a framework (and only for the framework) and do it in one spot.  

It is my understanding that in a framework we need .h and .m files to declare 
the constants and I have set these up.

Now, I am trying to get this constants.m imported in one area that will allow 
every class within my framework to have access to them.

Thanks, Uli.
___

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: 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?
> 
> Is this in a different project that uses your framework? If so, it sounds 
> like Constants.h didn’t get built into the framework’s Headers directory. So 
> yeah, check that the header is marked as Public for the target that builds 
> the framework.
> 

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.

I just tried adding the constants.h file to the public headers of in the build 
settings of the framework.  That doesn't work.  Build errors for undeclared 
identifiers for the constants. 
I just tried importing the constants.h into my framework.h.  That doesn't work. 
Build errors for undeclared identifiers for the constants.





___

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