Send Cocoa-dev mailing list submissions to
email@hidden
To subscribe or unsubscribe via the World Wide Web, visit
http://lists.apple.com/mailman/listinfo/cocoa-dev
or, via email, send a message with subject or body 'help' to
email@hidden
You can reach the person managing the list at
email@hidden
When replying, please edit your Subject line so it is more specific
than "Re: Contents of Cocoa-dev digest..."
Today's Topics:
1. Re: What happens when I call NSMakeCollectable on a
CFArrayRef? (mmalc crawford)
2. Re: why are there zero examples in the cocoa docs?! (Joeles
Baker)
3. Re: why are there zero examples in the cocoa docs?! (Hamish
Allan)
4. Re: What happens when I call NSMakeCollectable on a
CFArrayRef? (Clark Cox)
5. Re: Linking against HIServices? (Twisted Theory Software)
6. Re: why are there zero examples in the cocoa docs?! (Scott
Andrew)
7. Multiple Views and NSWindowController (Philip Bridson)
8. Re: why are there zero examples in the cocoa docs?! (I. Savant)
9. Re: Multiple Views and NSWindowController (Scott Andrew)
10. Scripting: Dynamic properties possible (straightforwardly)?
(Luke Evans)
11. Re: "Convert to Objective-c 2.0" (Bill Bumgarner)
12. Re: Multiple Views and NSWindowController (Philip Bridson)
13. Re: How do I add a framework to XCode? (arri mafkees)
14. Re: designing beyond MV and (one) C (Ken Thomases)
15. Where should AppleScripts reside? (Devraj Mukherjee)
----------------------------------------------------------------------
Message: 1
Date: Sat, 19 Jan 2008 15:04:49 -0800
From: mmalc crawford <email@hidden>
Subject: Re: What happens when I call NSMakeCollectable on a
CFArrayRef?
To: Andrew Thompson <email@hidden>
Cc: cocoa dev <email@hidden>
Message-ID: <email@hidden>
Content-Type: text/plain; charset=US-ASCII; format=flowed; delsp=yes
On Jan 19, 2008, at 2:56 PM, Andrew Thompson wrote:
I want to call a Core function that returns a CFArrayRef and make
the result garbage collectable.
The CFArray contains CFStrings...
Is this pattern OK?
-(NSArray *) doFoo {
return NSMakeCollectable(CFCopyFoo(someArgs));
}
Where CFCopyFoo returns a new CFArray containing copied CFStrings.
{CF,NS}MakeCollectable only apply to the argument:
<http://developer.apple.com/documentation/Cocoa/Conceptual/GarbageCollection/Articles/gcCoreFoundation.html
mmalc
------------------------------
Message: 2
Date: Sun, 20 Jan 2008 00:11:09 +0100
From: Joeles Baker <email@hidden>
Subject: Re: why are there zero examples in the cocoa docs?!
To: email@hidden
Message-ID: <email@hidden>
Content-Type: text/plain; charset=US-ASCII; format=flowed
Hi I. Savant, Andrew, Kyle,
just wanted to say thank you for all your comments.
I hope they'll help me on my way.
:-)
best
--Joeles
------------------------------
Message: 3
Date: Sat, 19 Jan 2008 23:16:18 +0000
From: "Hamish Allan" <email@hidden>
Subject: Re: why are there zero examples in the cocoa docs?!
To: "Joeles Baker" <email@hidden>
Cc: email@hidden
Message-ID:
<email@hidden>
Content-Type: text/plain; charset=ISO-8859-1
On Jan 19, 2008 7:47 PM, Joeles Baker <email@hidden>
wrote:
why does the documentation suck so much (for beginners)? :-)
...
"Each array element is an NSDictionary containing key-value pairs."
...
but i have really no idea how that chapterarray should look like :-/
...
looking forward for the "initial hint" that will hopefully light the
spark :-)
My initial hint would be: if you approach mailing lists with humility
rather than casting aspersions, you're less likely to be told to RTFM.
My follow-up hint would be: if you don't know what an NSDictionary
is, RTFM!
Hamish
P.S. Please read this email tongue-in-cheek; if others hadn't already
made such constructive replies, I'd have tried to be more helpful :)
------------------------------
Message: 4
Date: Sat, 19 Jan 2008 15:17:41 -0800
From: "Clark Cox" <email@hidden>
Subject: Re: What happens when I call NSMakeCollectable on a
CFArrayRef?
To: "Andrew Thompson" <email@hidden>
Cc: cocoa dev <email@hidden>
Message-ID:
<email@hidden>
Content-Type: text/plain; charset=UTF-8
On Jan 19, 2008 2:56 PM, Andrew Thompson <email@hidden> wrote:
I want to call a Core function that returns a CFArrayRef and make the
result garbage collectable.
The CFArray contains CFStrings...
Is this pattern OK?
-(NSArray *) doFoo {
return NSMakeCollectable(CFCopyFoo(someArgs));
}
Where CFCopyFoo returns a new CFArray containing copied CFStrings.
This will make the array collectable, but will do nothing to the items
contained therein; the contents are still reference counted. However,
this is most likely what you want anyway (Just as in pre-GC code, when
an item is removed from the array, or the array itself is
collected/deallocated, the item will have its reference count
decremented, and will be deallocated if that was the last remaining
reference).
Or do I have to iterate over the array and call NSMakeCollectable on
each item in it?
That would do something completely different, and would not be a good
idea (it would be akin to calling CFRelease on each of the items).
--
Clark S. Cox III
email@hidden
------------------------------
Message: 5
Date: Sat, 19 Jan 2008 17:22:20 -0600
From: Twisted Theory Software <email@hidden>
Subject: Re: Linking against HIServices?
To: cocoadev <email@hidden>
Message-ID:
<email@hidden>
Content-Type: text/plain; charset=US-ASCII; format=flowed; delsp=yes
On 19 Jan, 2008, at 4:58 PM, Kyle Sluder wrote:
On 1/19/08, Twisted Theory Software <email@hidden
wrote:
I'm trying to use the private API CoreMenuExtraAddMenuExtra(), which
is compiled into HIServices. However, adding its umbrella
framework,
ApplicationServices, does not link correctly. I'm working in
Leopard,
but compiling against 10.4u SDK.
On Tiger:
$ strings /System/Library/Frameworks/ApplicationServices.framework/
Frameworks/HIServices.framework/Versions/A/HIServices
|grep Menu |wc -l
0
So it doesn't exist?
Try:
$ grep CoreMenuExtraAddMenuExtra /System/Library/Frameworks/
ApplicationServices.framework/Frameworks/HIServices.framework/
Versions/
A/HIServices
Binary file /System/Library/Frameworks/ApplicationServices.framework/
Frameworks/HIServices.framework/Versions/A/HIServices matches
$
Josh
------------------------------
Message: 6
Date: Sat, 19 Jan 2008 15:24:34 -0800
From: Scott Andrew <email@hidden>
Subject: Re: why are there zero examples in the cocoa docs?!
To: Hamish Allan <email@hidden>
Cc: "email@hidden" <email@hidden>
Message-ID: <email@hidden>
Content-Type: text/plain; charset=US-ASCII; format=flowed;
delsp=yes
Sent from my iPod
On Jan 19, 2008, at 3:16 PM, "Hamish Allan" <email@hidden> wrote:
On Jan 19, 2008 7:47 PM, Joeles Baker <email@hidden>
wrote:
why does the documentation suck so much (for beginners)? :-)
...
"Each array element is an NSDictionary containing key-value pairs."
...
but i have really no idea how that chapterarray should look like :-/
...
looking forward for the "initial hint" that will hopefully light the
spark :-)
My initial hint would be: if you approach mailing lists with humility
rather than casting aspersions, you're less likely to be told to
RTFM.
My follow-up hint would be: if you don't know what an NSDictionary
is, RTFM!
Hamish
P.S. Please read this email tongue-in-cheek; if others hadn't already
made such constructive replies, I'd have tried to be more helpful :)
_______________________________________________
Cocoa-dev mailing list (email@hidden)
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:
This email sent to email@hidden
------------------------------
Message: 7
Date: Sat, 19 Jan 2008 23:29:55 +0000
From: Philip Bridson <email@hidden>
Subject: Multiple Views and NSWindowController
To: Cocoa Development <email@hidden>
Message-ID: <email@hidden>
Content-Type: text/plain; charset=US-ASCII; delsp=yes;
format=flowed
I have recently been working on using multiple nibs in a file. I had
no trouble loading nibs but I could not change the view. Now I can
load the view but cannot display windows, I don't understand why this
is as I have not changed the code that I used to open the window.
Below is an excerpt from my app.
//This is the header file for my Window Controller
@interface MyWindowController : NSWindowController {
IBOutlet NSWindow *myWindow;
IBOutlet NSBox *myBox;
IBOutlet NSView *primaryView;
IBOutlet NSView *subView;
}
-(IBAction)cancel:(id)sender;
-(IBAction)previous:(id)sender;
-(IBAction)next:(id)sender;
@end
//Implementation File
@implementation MyWindowController
-(IBAction)cancel:(id)sender
{
[self close];
[self release];
}
-(IBAction)previous:(id)sender
{
[subView removeFromSuperview];
[myBox addSubview:primaryView];
}
-(IBAction)next:(id)sender
{
[primaryView removeFromSubview];
[myBox addSubview:subView];
}
@end
//Action Controller - creates an instance of the window.
@interface MyAction : NSObject {
}
-(IBAction)openEditWindow;
@end
//Implementation
@Implementation MyAction
-(IBAction)openEditWindow
{
NSWindowController *_newWindow = [[NSWindowController alloc]
initWindowWithNibName:@"MyNib"];
[_newWindow showWindow:self];
}
@end
I had been opening windows like this via a button press from a
seperate nib and it had been working fine. Now I can't get it to do
anything. Also,, how do I initialize myBox to have primaryView
displayed when I load the nib? Previously, when the code above did
work, myBox would appear in the window bu would have no subview.
Thanks guys...
Phil
------------------------------
Message: 8
Date: Sat, 19 Jan 2008 18:34:27 -0500
From: "I. Savant" <email@hidden>
Subject: Re: why are there zero examples in the cocoa docs?!
To: Boyd Collier <email@hidden>
Cc: Cocoa-Dev Apple <email@hidden>
Message-ID: <email@hidden>
Content-Type: text/plain; charset=US-ASCII; format=flowed; delsp=yes
On Jan 19, 2008, at 5:59 PM, Boyd Collier wrote:
Objective-C is a superset of C, not C++, as I'm sure he knows.
Thought I should mentioned it, lest the originator of the original
question (rant?) thinks he needs to start learning C++ (God forbid).
Of course you're right. I always say "C++" for some reason. :-)
--
I.S.
------------------------------
Message: 9
Date: Sat, 19 Jan 2008 15:42:38 -0800
From: Scott Andrew <email@hidden>
Subject: Re: Multiple Views and NSWindowController
To: Philip Bridson <email@hidden>
Cc: Cocoa Development <email@hidden>
Message-ID: <email@hidden>
Content-Type: text/plain; charset=US-ASCII; format=flowed;
delsp=yes
So the obvious question is do you have the controller's window
variable pointing to the window in the nob file?
On Jan 19, 2008, at 3:29 PM, Philip Bridson <email@hidden>
wrote:
I have recently been working on using multiple nibs in a file. I had
no trouble loading nibs but I could not change the view. Now I can
load the view but cannot display windows, I don't understand why
this is as I have not changed the code that I used to open the
window. Below is an excerpt from my app.
//This is the header file for my Window Controller
@interface MyWindowController : NSWindowController {
IBOutlet NSWindow *myWindow;
IBOutlet NSBox *myBox;
IBOutlet NSView *primaryView;
IBOutlet NSView *subView;
}
-(IBAction)cancel:(id)sender;
-(IBAction)previous:(id)sender;
-(IBAction)next:(id)sender;
@end
//Implementation File
@implementation MyWindowController
-(IBAction)cancel:(id)sender
{
[self close];
[self release];
}
-(IBAction)previous:(id)sender
{
[subView removeFromSuperview];
[myBox addSubview:primaryView];
}
-(IBAction)next:(id)sender
{
[primaryView removeFromSubview];
[myBox addSubview:subView];
}
@end
//Action Controller - creates an instance of the window.
@interface MyAction : NSObject {
}
-(IBAction)openEditWindow;
@end
//Implementation
@Implementation MyAction
-(IBAction)openEditWindow
{
NSWindowController *_newWindow = [[NSWindowController alloc]
initWindowWithNibName:@"MyNib"];
[_newWindow showWindow:self];
}
@end
I had been opening windows like this via a button press from a
seperate nib and it had been working fine. Now I can't get it to do
anything. Also,, how do I initialize myBox to have primaryView
displayed when I load the nib? Previously, when the code above did
work, myBox would appear in the window bu would have no subview.
Thanks guys...
Phil
_______________________________________________
Cocoa-dev mailing list (email@hidden)
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:
This email sent to email@hidden
------------------------------
Message: 10
Date: Sat, 19 Jan 2008 15:48:29 -0800
From: Luke Evans <email@hidden>
Subject: Scripting: Dynamic properties possible (straightforwardly)?
To: Cocoa-Dev Dev <email@hidden>
Message-ID: <email@hidden>
Content-Type: text/plain; charset=US-ASCII; format=flowed; delsp=yes
I have an object that (amongst other things) can hold a set of
'variables'. These are simply name/value pairs, and the value is
polymorphic (in fact, they are NSMutableObjects with a 'value' field
that corresponds to the storage types in Core Data).
The behaviour of the 'variables' is supposed to be simple. Ergo, if
you ask for a variable by name that doesn't exist, you get nil, but
you can set a value to a name that doesn't exist, in which case a new
variable is added to the set, with the right value type (i.e the
construction of the variable is hidden/automatic).
In the basic code I have chosen (for convenience I thought) to
implement a form of dynamic key on the container object for the
variables, such that it responds to valueWithKey: and setValue:withKey
for any key path that is prefixed by "variable.". Whether or not this
is a great idea is another matter, but it allows the container object
to react directly to values, rather than introducing another level of
object the 'variable' itself, which is then indirected to get the
value properly (though this is exactly what happens in the model - the
dynamic key stuff is just a short-cut).
Now that I'm going through adding scriptability for this stuff, I'm
somewhat hoisted by my own petard. In order to mirror the convenience
of being able to get/set variables on the top level container object,
I would need to be able to describe dynamic keys in my sdef file, and
then (presumably) my existing KVC accessors would work, so long as the
key was allowed to be of the right form "variable.<varName>" - though
this might itself be a pipedream.
If I go more with the flow of regular scripting, then I suppose I
ought to expose the 'variables' layer, so you could get the variable
with a specific na