[iPhone 3.1] NSInvocation on main thread?

2010-02-10 Thread John Michael Zorko
Hello, all ... I'm using NSInvocation so I can pass multiple arguments to delegate methods. However, I also want these delegate methods to get called on the main thread. Is there a way that I can use NSInvocation to call the method it wraps on the main thread, like performSelectorOnMainThread?

Re: Is a good practice to alloc an object and defer the initialization to another object?

2010-02-10 Thread Scott Ribe
> id obj; > if (.) > obj = [Class1 alloc]; > else > obj = [Class2 alloc]; > obj = [obj initWithFoo: bar:]; -- Scott Ribe scott_r...@killerbytes.com http://www.killerbytes.com/ (303) 722-0567 voice ___ Cocoa-dev mailing list (Cocoa-dev@lis

Re: What classes have -init?

2010-02-10 Thread Quincey Morris
On Feb 10, 2010, at 12:23 PM, James Walker wrote: > I think at times I've written things like [[NSMutableArray alloc] init] with > no apparent ill effects, but now I notice that the docs for NSMutableArray > and NSArray don't say that there is an init method. The NSObject docs say > that an in

Re: [iPhone 3.1] navigationItem.backBarButtonItem weirdness

2010-02-10 Thread Roland King
well here's what the documentation has to say about the backBarButtonItem property you are trying to set. When this item is the back item of the navigation bar—when it is the next item below the top item—it may be represented as a back button on the navigation bar. Use this property to specify

Re: What classes have -init?

2010-02-10 Thread Scott Anguish
True. But most classes have designated initializers that configure the class properly. They should be documented, although typically they’re used for subclassing the class. On Feb 10, 2010, at 3:49 PM, Henry McGilton (Boulevardier) wrote: > > On Feb 10, 2010, at 12:23 PM, James Walker wrote:

Find in a WebKit view?

2010-02-10 Thread Peter N Lewis
Is there any way to add support for the normal Cocoa Find functionality in a WebKit view? Failing that, is there any other way to get search functionality in a WebKit view? I want to do some in-app documentation, and Apple's Help system is so bad I've finally given up on that (floating window!

[MODERATOR] Re: How to resume an XCode Download

2010-02-10 Thread Scott Anguish
You’re correct. This isn’t relevant to development. And as a result it doesn’t belong here. Perhaps the xcode-users list might be more appropriate. On Feb 10, 2010, at 4:28 AM, Tharindu Madushanka wrote: > This may not relevant to development directly but I could not find an answer > for this

Re: Using NSKeyedArchiver to save and restore state on iPhone apps

2010-02-10 Thread Chris Hanson
On Feb 10, 2010, at 4:38 PM, Jason Bobier wrote: > This idea came about because I was annoyed at having to do it again and > realized that everything that I wanted to store was NSCoding compliant, which > means that it should be archivable. It appears that some of the NSCoding > compliant objec

Re: NSArray (unique Items matching x)

2010-02-10 Thread Trygve Inda
> You can do this using Key Value Coding, specifically using the collection > operators like @distinctUnionOfSets etc. > > -Steven > > > On Wed, Feb 10, 2010 at 9:11 PM, Jens Alfke wrote: > >> >> On Feb 10, 2010, at 1:45 PM, Trygve Inda wrote: >> >>> iTunes seems to do this with the column b

[MEET] CocoaHeads-NYC tomorrow (Thursday) night

2010-02-10 Thread Andy Lee
Marc van Olmen will give a talk entitled "Introduction to NSOperation". As usual: (1) Please feel free to bring questions, code, and works in progress. We have a projector and we like to see code and try to help. (2) We'll have food and beer afterwards. (3) If there's a topic you'd like prese

Re: Core Data: Insert, Fetch, Re-Fetch. Same Object?

2010-02-10 Thread Jerry Krinock
On 2010 Feb 10, at 18:05, Jens Alfke wrote: >> I've always wondered if I insert a managed object, then later fetch it >> repeatedly from the same managed object context, do I get the same object >> every time? > > Yes, basically. There is only going to be one in-memory object at a time that >

Re: NSArray (unique Items matching x)

2010-02-10 Thread Steven Degutis
You can do this using Key Value Coding, specifically using the collection operators like @distinctUnionOfSets etc. -Steven On Wed, Feb 10, 2010 at 9:11 PM, Jens Alfke wrote: > > On Feb 10, 2010, at 1:45 PM, Trygve Inda wrote: > > > iTunes seems to do this with the column browser... Eg when you

Re: NSArray (unique Items matching x)

2010-02-10 Thread Jens Alfke
On Feb 10, 2010, at 1:45 PM, Trygve Inda wrote: > iTunes seems to do this with the column browser... Eg when you select > "Classic Rock", it pulls up a list of Artists without duplicates in the > list... And does it very fast. But keep in mind that iTunes is a Carbon app, not Cocoa. > It seems

Re: Core Data: Insert, Fetch, Re-Fetch. Same Object?

2010-02-10 Thread Jens Alfke
On Feb 10, 2010, at 4:44 PM, Jerry Krinock wrote: > I've always wondered if I insert a managed object, then later fetch it > repeatedly from the same managed object context, do I get the same object > every time? Yes, basically. There is only going to be one in-memory object at a time that re

Re: NSTextField restriction

2010-02-10 Thread Graham Cox
On 11/02/2010, at 11:55 AM, Angelo Chen wrote: > I have a NSTextField outlet, and I'd like to limit the input to: > 1) only upper case alpha characters2) must be two characters > Any idea how to achieve this? Thanks, Make a custom subclass of NSFormatter and attach it to the field. --Graham

NSTextField restriction

2010-02-10 Thread Angelo Chen
Hi, I have a NSTextField outlet, and I'd like to limit the input to: 1) only upper case alpha characters2) must be two characters Any idea how to achieve this? Thanks, Angelo ___ YM - 離線訊息 就算你沒有上網,你的朋友仍可以留下訊息給你,當你上網時就能立即看到,任何說話都冇走失。 http://messenger.yahoo.com

Re: NSXML and >

2010-02-10 Thread Keith Blount
Still working on this and still getting nowhere, so another question: Is there a way to prevent NSXMLElement converting '&' into '&' so that I can resolve character entities myself in my own NSXMLElement category -init... method? To recap the problem, the NSXML classes change '<' into '<' and '

Core Data: Insert, Fetch, Re-Fetch. Same Object?

2010-02-10 Thread Jerry Krinock
I've always wondered if I insert a managed object, then later fetch it repeatedly from the same managed object context, do I get the same object every time? (Assume that there is only one object which matches the given predicate.) This may be important if I want to, say, set an instance variab

Re: Using NSKeyedArchiver to save and restore state on iPhone apps

2010-02-10 Thread Jason Bobier
Hey Ricky, I'm strictly attempting to archive the controllers and views hierarchy starting from the navcontroller. My data model is quite separate from all of this. I've often done similar things to what you recommend, but complex interfaces often include tab controllers, nav controllers, modal

Re: [iPhone 3.1] navigationItem.backBarButtonItem weirdness

2010-02-10 Thread John Michael Zorko
Peter, Yeah, but I get no NSException when I press the back button -- it does what it's always done (which I want). Also, I added the colon and it still doesn't even try to call my selector. In short, it works -- but i'm not sure _why_ it works. Regards, John > your selector is missing colo

NSTableView not supplying expected object type

2010-02-10 Thread Graham Cox
I have a table view with 4 columns, connected to a conventional datasource. The first 3 columns are fully set up in IB to have text field cells with attached number formatters. The 4th column has a variable data type where the user indirectly chooses a data type and the code dynamically sets the

Re: Using NSKeyedArchiver to save and restore state on iPhone apps

2010-02-10 Thread Jason Bobier
Yes, you have to account for any references into the unarchived graph that objects not included in the graph hold. In my case, this should be as simple as removing the navcontroller view from it's superview. Jason On Feb 10, 2010, at 4:19 PM, Kyle Sluder wrote: > On Wed, Feb 10, 2010 at 12:54

Re: [iPhone 3.1] navigationItem.backBarButtonItem weirdness

2010-02-10 Thread Peter Blazejewicz
Hi John, your selector is missing colon: @selector(back:) for method: -(IBAction)back:(id)sender hth, regards, Peter Blazejewicz On Thu, Feb 11, 2010 at 1:10 AM, John Michael Zorko wrote: > > Hello, all ... > > I've a question about the UINavigationController backBarButtonItem property. > I

[iPhone 3.1] navigationItem.backBarButtonItem weirdness

2010-02-10 Thread John Michael Zorko
Hello, all ... I've a question about the UINavigationController backBarButtonItem property. I wanted to merely set my own image for the back button, instead of it using the title of the controller above in the hierarchy. So, this is what I did (yes this app is using Three20, but I don't think

Re: Using NSKeyedArchiver to save and restore state on iPhone apps

2010-02-10 Thread Ricky Sharp
On Feb 10, 2010, at 12:40 PM, Jason Bobier wrote: > As many of you know, saving and restoring complex navigation hierarchies on > the iPhone can be a real chore. So, I had this brilliant idea of setting up > my app delegate like this: > > applicationDidFinishLaunching > if userdefaults c

NSArray (unique Items matching x)

2010-02-10 Thread Trygve Inda
I have an array of Dicts with two fields in each (for example) Name and City Given a Name, I'd like to find all unique Cities or vis-versa. iTunes seems to do this with the column browser... Eg when you select "Classic Rock", it pulls up a list of Artists without duplicates in the list... And d

Re: Using NSKeyedArchiver to save and restore state on iPhone apps

2010-02-10 Thread Kyle Sluder
On Wed, Feb 10, 2010 at 12:54 PM, Jason Bobier wrote: > All of these are NSCoding compliant, which means that if I archive it, I > should be able to unarchive it and get the exact state back (subject to > conditional archiving, etc...) as long as I archive a complete object graph. Not true. You

Re: Is a good practice to alloc an object and defer the initialization to another object?

2010-02-10 Thread Jesper Storm Bache
For this use case you can also use the fact that classes are objects. Something like the following: Class theClass = nil; if (.) theClass = [Class1 class]; else theClass = [Class2 class]; id obj = [[theClass alloc] initWithFoo:

Re: Using NSKeyedArchiver to save and restore state on iPhone apps

2010-02-10 Thread Jason Bobier
This is separate from my model. This is the restoration of the view and controller hierarchy that is expected of iPhone apps when they startup. Restoring this can be incredibly complex when you have lots of view controllers including nav controllers, tab bar controllers, and modal controllers al

Re: What classes have -init?

2010-02-10 Thread Henry McGilton (Boulevardier)
On Feb 10, 2010, at 12:23 PM, James Walker wrote: > I think at times I've written things like [[NSMutableArray alloc] init] with > no apparent ill effects, but now I notice that the docs for NSMutableArray > and NSArray don't say that there is an init method. The NSObject docs say > that an i

What classes have -init?

2010-02-10 Thread James Walker
I think at times I've written things like [[NSMutableArray alloc] init] with no apparent ill effects, but now I notice that the docs for NSMutableArray and NSArray don't say that there is an init method. The NSObject docs say that an init method might raise an exception. Is there some other i

Re: Large queue of messages for another app

2010-02-10 Thread Jens Alfke
On Feb 10, 2010, at 12:03 PM, Trygve Inda wrote: > Once the files are processed by the sub app, I need to send a properties > NSDictionary back to the main app. This can't really be handled by an 'odoc' > event - Any AppleEvent can send a reply containing structured data. Although you're right

Re: Using NSKeyedArchiver to save and restore state on iPhone apps

2010-02-10 Thread Jens Alfke
On Feb 10, 2010, at 10:40 AM, Jason Bobier wrote: > In theory, the archived navcontroller should contain my complex view > controller hierarchy and all of the related views, so this should work. > However, when I unarchive and add to view to the window, the subviews rarely > have all of their v

Re: Is a good practice to alloc an object and defer the initialization to another object?

2010-02-10 Thread Jens Alfke
On Feb 10, 2010, at 5:27 AM, Giannandrea Castaldi wrote: > I would like to alloc an object and defer the initialization to > another object, is a good practice? The reason is that I can alloc > several types of objects but the init method have the same signature. It's unusual, but I've done it o

Re: Large queue of messages for another app

2010-02-10 Thread Trygve Inda
> > On Feb 9, 2010, at 10:47 PM, Trygve Inda wrote: > >> 1) Apple Events... These are messy but I'd go there if it'd not have lost >> events. > > Bingo. This is a really typical use case. The 'odoc' AppleEvent does exactly > what you want. Just use NSWorkspace or LaunchServices to tell the other

Re: Core Data Issue with Binding

2010-02-10 Thread Kyle Sluder
On Wed, Feb 10, 2010 at 9:26 AM, Matthew Miller wrote: > @property (nonatomic, retain) NSDate *DateOfBirth; > @property (nonatomic, retain) NSString *FirstName; > @property (nonatomic, retain) NSString *LastName; > @property (nonatomic, retain) NSNumber *DraftClass; > @property (nonatomic, retain)

Re: Is a good practice to alloc an object and defer the initialization to another object?

2010-02-10 Thread Kyle Sluder
On Wed, Feb 10, 2010 at 5:27 AM, Giannandrea Castaldi wrote: > I would like to alloc an object and defer the initialization to > another object, is a good practice? The reason is that I can alloc > several types of objects but the init method have the same signature. No. You must always do [[Foo

Re: Running NSURLConnection from within an NSOperation?

2010-02-10 Thread Scott Anguish
There is at least one iPhone example that users the URL Loading System with NSOperation. On Feb 9, 2010, at 4:12 PM, Laurent Daudelin wrote: > I'm trying to run an NSURLConnection from an NSOperation. Apparently, it > won't run. I know that NSURLConnection need a run loop. Does that mean I'll

Using NSKeyedArchiver to save and restore state on iPhone apps

2010-02-10 Thread Jason Bobier
As many of you know, saving and restoring complex navigation hierarchies on the iPhone can be a real chore. So, I had this brilliant idea of setting up my app delegate like this: applicationDidFinishLaunching if userdefaults contains an archived navcontroller unarchive co

Core Data Issue with Binding

2010-02-10 Thread Matthew Miller
I'm having trouble with a Cocoa app built around an NSManagedObject model. Without getting too far into the weeds, there is a Player object: @class Program; @interface Player : NSManagedObject { } @property (nonatomic, retain) NSDate *DateOfBirth; @property (nonatomic, retain) NSString *FirstN

Is a good practice to alloc an object and defer the initialization to another object?

2010-02-10 Thread Giannandrea Castaldi
Hi, I would like to alloc an object and defer the initialization to another object, is a good practice? The reason is that I can alloc several types of objects but the init method have the same signature. Thanks. Jean ___ Cocoa-dev mailing list (Cocoa-de

Re: How to resume an XCode Download

2010-02-10 Thread Kyle Sluder
On Wed, Feb 10, 2010 at 1:28 AM, Tharindu Madushanka wrote: > This may not relevant to development directly but I could not find an answer > for this over web.. may be someone experienced the same could help me here.. Tools questions belong on the xcode-users list. --Kyle Sluder

Re: How to resume an XCode Download

2010-02-10 Thread Michael Ash
On Wed, Feb 10, 2010 at 11:45 AM, Richard Somers wrote: > On Feb 10, 2010, at 2:28 AM, Tharindu Madushanka wrote: > >> Is there any way I could resume a broken XCode download due to session >> expire.. > > I also have a slow connection. I have never been able to resume a broken > XCode download. T

Re: Large queue of messages for another app

2010-02-10 Thread Jens Alfke
On Feb 9, 2010, at 10:47 PM, Trygve Inda wrote: > 1) Apple Events... These are messy but I'd go there if it'd not have lost > events. Bingo. This is a really typical use case. The 'odoc' AppleEvent does exactly what you want. Just use NSWorkspace or LaunchServices to tell the other app to ope

Re: How to resume an XCode Download

2010-02-10 Thread Todd Heberlein
My problem is that my ISPs use long-haul WiFi links that seem to go down fairly regularly (which is why I keep redundant ISPs). This make multi-hour downloads occasionally frustrating. Todd On Feb 10, 2010, at 9:00 AM, Philip Ershler wrote: > > On Feb 10, 2010, at 9:45 AM, Richard Somers wrot

Re: How to resume an XCode Download

2010-02-10 Thread Philip Ershler
On Feb 10, 2010, at 9:45 AM, Richard Somers wrote: > On Feb 10, 2010, at 2:28 AM, Tharindu Madushanka wrote: > >> Is there any way I could resume a broken XCode download due to session >> expire.. > > I also have a slow connection. I have never been able to resume a broken > XCode download. T

Re: Running NSURLConnection from within an NSOperation?

2010-02-10 Thread Jerry Krinock
On 2010 Feb 10, at 01:43, Greg Reichow wrote: > the things you learn by posting a bad answer. -sendSynchronousRequest: is not necessarily a bad answer, Greg. In some situations it is adequate, and then it is the correct choice due to its simplicity. __

Re: How to resume an XCode Download

2010-02-10 Thread Richard Somers
On Feb 10, 2010, at 2:28 AM, Tharindu Madushanka wrote: Is there any way I could resume a broken XCode download due to session expire.. I also have a slow connection. I have never been able to resume a broken XCode download. The only solution I have found is making sure your computer stay

Re: -[NSBundle preferredLocalizations]

2010-02-10 Thread Douglas Davidson
On Feb 10, 2010, at 5:52 AM, Kai Brüning wrote: > Could somebody with insight confirm whether this is a documentation bug? This is indeed an error in the documentation. Please file a bug against the documentation with the information you have provided. Douglas Davidson

Re: NSXML and >

2010-02-10 Thread Keith Blount
Hi, Just to follow up on this as I'm still having problems have done some more testing and double-checked the XML specs. Yet again it seems that the NSXML classes are better at validating invalid XML when opening documents than when generating XML data. If you include the string "]]>" inside t

-[NSBundle preferredLocalizations]

2010-02-10 Thread Kai Brüning
Hi, Apple’s documentation states about -[NSBundle preferredLocalizations]: "The localizations in the array are not returned in any particular order." This makes no sense, I’d expect this to be true for -[NSBundle localizations], why I’d expect -[NSBundle preferredLocalizations] to be implemente

how to cancel / time out authorisation window through code

2010-02-10 Thread Rajendran P
hi I am currently working on a Cocoa Application in which i pop up an authorisation window using AuthorizationCreate . if the user has not responded to it with a time say 60 seconds , i want to cancel/timeout the pop up window created by above authorisationCreate . how can i cancel / tim

Re: Running NSURLConnection from within an NSOperation?

2010-02-10 Thread Greg Reichow
>>> I'm trying to run an NSURLConnection from an NSOperation. Apparently, it >>> won't run. I know that NSURLConnection need a run loop. Does that mean I'll >>> have to setup some kind of NSTime in my NSOperation and then call my run >>> loop at regular intervals? >> >> Try using the synchrono

How to resume an XCode Download

2010-02-10 Thread Tharindu Madushanka
Hi, This may not relevant to development directly but I could not find an answer for this over web.. may be someone experienced the same could help me here.. I have an internet connection with speed around 50-60kbps.. Last time it nearly took 12 hours to download the full iPhone SDK with 2.x Gig.