Re: Can an app query the values in its own Info.plist?

2009-09-29 Thread Ken Ferry
On Sun, Sep 27, 2009 at 10:24 PM, Scott Anguish sc...@cocoadoc.com wrote:


 On Sep 28, 2009, at 1:16 AM, Kyle Sluder wrote:

  On Sun, Sep 27, 2009 at 10:02 PM, Scott Anguish sc...@cocoadoc.com
 wrote:

 Why do it? It's easy enough to add your own.


 It's also easy to add them to Info.plist… it seems like an appropriate
 place to do so.

 Perhaps Apple should clarify whether adding custom keys to Info.plist
 is condoned.


 Perhaps. I honestly don't think we have a best-practices position on this.

 I guess I'll point you to bugreporter.apple.com, you being a good citizen
 and all. :-)


Not that this is a guideline, but it does feel a little weird to me to see
certain sorts of information in the Info.plist.  To my mind, it's for
information consumed by processes other than your own.

-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:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Re: Can an app query the values in its own Info.plist?

2009-09-28 Thread Jim Correia

On Sep 28, 2009, at 1:34 AM, Kyle Sluder wrote:


Done.  rdar://problem://7257097

Also notes that the same collision issue exists for user defaults,
where AppKit stores window and splitter autosave information.


It is unlikely that any apple framework is ever going to introduce a  
key of the form


com.your-domain.KeyName

If you define your custom Info.plist keys using reverse DNS style  
keys, the collision issue should become a non-issue.


Jim
___

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:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Re: Can an app query the values in its own Info.plist?

2009-09-27 Thread Kyle Sluder
On Sun, Sep 27, 2009 at 8:33 PM, Hippo Man apple.hippo...@gmail.com wrote:
 Is there a way for me to put my own, custom key into a Cocoa
 application's Info.plist and have the application query that key's
 setting?

Yes, using -[NSBundle infoDictionary].  And of course you can get the
app's bundle by using +[NSBundle mainBundle].
http://developer.apple.com/mac/library/DOCUMENTATION/Cocoa/Reference/Foundation/Classes/NSBundle_Class/Reference/Reference.html#//apple_ref/doc/uid/2214-BCICBHBA

--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:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Re: Can an app query the values in its own Info.plist?

2009-09-27 Thread Kiel Gillard
http://developer.apple.com/mac/library/DOCUMENTATION/Cocoa/Reference/Foundation/Classes/NSBundle_Class/Reference/Reference.html#//apple_ref/occ/instm/NSBundle/infoDictionary 



Generally one does not put custom keys in the Info.plist. You might  
want to consider a separate plist resource for your target and use  
NSBundle's pathForResource:ofType: method to query the dictionary at  
the resulting path. For more information see: http://developer.apple.com/mac/library/DOCUMENTATION/Cocoa/Reference/Foundation/Classes/NSBundle_Class/Reference/Reference.html#//apple_ref/occ/instm/NSBundle/pathForResource:ofType: 



Kiel

On 28/09/2009, at 1:33 PM, Hippo Man wrote:


Is there a way for me to put my own, custom key into a Cocoa
application's Info.plist and have the application query that key's
setting?

I know that I can use the dictionaryWithContentsOfFile: method of an
NSDictionary to read an arbitrary, dictionary-like property list,
given its pathname. However, I'm wondering if there's a way to
automatically get one or more settings in the current Cocoa
application's Info.plist without knowing anything about its pathname.
In other words, I want to query settings from my Info.plist.

Is this possible? If so, could someone point me to some docs which
describe how to do this?

Thanks in advance.

--
HippoMan apple.hippo...@gmail.com
___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/kiel.gillard%40gmail.com

This email sent to kiel.gill...@gmail.com


___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Re: Can an app query the values in its own Info.plist?

2009-09-27 Thread Kyle Sluder
On Sun, Sep 27, 2009 at 8:47 PM, Kiel Gillard kiel.gill...@gmail.com wrote:
 Generally one does not put custom keys in the Info.plist. You might want to
 consider a separate plist resource for your target and use NSBundle's
 pathForResource:ofType: method to query the dictionary at the resulting
 path. For more information see:

Come again?  Info.plist is a perfectly fine place to put this
information, and very many apps put custom information there.  That's
where Sparkle expects its configuration information.

--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:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Re: Can an app query the values in its own Info.plist?

2009-09-27 Thread Graham Cox


On 28/09/2009, at 1:47 PM, Kiel Gillard wrote:


Generally one does not put custom keys in the Info.plist.



Why not? As long as you're careful to ensure no conflict now or in the  
future with Apple's defined keys, you'll be fine (so ensure you use a  
key that couldn't possibly be used by Apple, such as prefixed with  
your name, etc - same as for any Objective-C class you create yourself  
in other words). I've seen plenty of third party code add keys to  
Info.plist, e.g. Sparkle.


--Graham


___

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:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Re: Can an app query the values in its own Info.plist?

2009-09-27 Thread Kiel Gillard


On 28/09/2009, at 2:23 PM, Graham Cox wrote:



On 28/09/2009, at 1:47 PM, Kiel Gillard wrote:


Generally one does not put custom keys in the Info.plist.



Why not? As long as you're careful to ensure no conflict now or in  
the future with Apple's defined keys, you'll be fine (so ensure you  
use a key that couldn't possibly be used by Apple, such as prefixed  
with your name, etc - same as for any Objective-C class you create  
yourself in other words). I've seen plenty of third party code add  
keys to Info.plist, e.g. Sparkle.


--Graham


Duh. Not sure what I was thinking. Sorry, Hippo Man. Thanks for the  
heads up, Graham and Kyle.


Kiel
___

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:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Re: Can an app query the values in its own Info.plist?

2009-09-27 Thread Scott Anguish

Better question...

Why do it? It's easy enough to add your own.

I don't see what the issue is with just adding another. not like  
they're hard to read and get access to the data.

On Sep 28, 2009, at 12:23 AM, Graham Cox wrote:



On 28/09/2009, at 1:47 PM, Kiel Gillard wrote:


Generally one does not put custom keys in the Info.plist.



Why not? As long as you're careful to ensure no conflict now or in  
the future with Apple's defined keys, you'll be fine (so ensure you  
use a key that couldn't possibly be used by Apple, such as prefixed  
with your name, etc - same as for any Objective-C class you create  
yourself in other words). I've seen plenty of third party code add  
keys to Info.plist, e.g. Sparkle.




___

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:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Re: Can an app query the values in its own Info.plist?

2009-09-27 Thread Hippo Man
 Duh. Not sure what I was thinking. Sorry, Hippo Man. Thanks for the
 heads up, Graham and Kyle.
 
 Kiel

Well, many thanks and much appreciation to all of you.

This is exactly the information I was looking for, and it's good to know
that there's a consensus that I _can_ put app-specific info into the
Info.plist.


-- 
 Hippo Man
 apple.hippo...@gmail.com

|.-, 0__0
|   /   (  oo'---,
|  /oo\
| ,\  |
| | \,=__/
|\  /
|/  /--|  /|
||__|-'|__|'
___

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:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Re: Can an app query the values in its own Info.plist?

2009-09-27 Thread Kyle Sluder
On Sun, Sep 27, 2009 at 10:02 PM, Scott Anguish sc...@cocoadoc.com wrote:
 Why do it? It's easy enough to add your own.

It's also easy to add them to Info.plist… it seems like an appropriate
place to do so.

Perhaps Apple should clarify whether adding custom keys to Info.plist
is condoned.

--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:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Re: Can an app query the values in its own Info.plist?

2009-09-27 Thread Scott Anguish


On Sep 28, 2009, at 1:16 AM, Kyle Sluder wrote:

On Sun, Sep 27, 2009 at 10:02 PM, Scott Anguish sc...@cocoadoc.com  
wrote:

Why do it? It's easy enough to add your own.


It's also easy to add them to Info.plist… it seems like an appropriate
place to do so.

Perhaps Apple should clarify whether adding custom keys to Info.plist
is condoned.


Perhaps. I honestly don't think we have a best-practices position on  
this.


I guess I'll point you to bugreporter.apple.com, you being a good  
citizen and all. :-)



___

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:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Re: Can an app query the values in its own Info.plist?

2009-09-27 Thread Kyle Sluder
Done.  rdar://problem://7257097

Also notes that the same collision issue exists for user defaults,
where AppKit stores window and splitter autosave information.

--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:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com