Re: [IB] - how to delete action or outlet?
On 18.07.2009, at 11:51, Chase Meadors wrote: IB should sync with it's relative Xcode project if they are both open. Are you actually saving changes to the AppController source files after you edit them? As I wrote, when I opened IB for the first time, Actions panel already had AppController.h title and contained my previously declared action. Therefore I thought IB was synchronized with the source file. Am I incorrect? On a second note, the - button is gray because you can only remove actions in IB that you've added in IB. Nice! And how to remove that action or at least how to rename it? For example I've done it by mistake, for testing or similar purposes. Now I can't remove such action or outlet, though I've closed IB, removed the action from the source file, then opened IB again. The action (or outlet) still exists in the object properties list. I think the only way to remove it is to edit XIB file manually - not a simple way, isn't it? Thanks. ___ 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: hide main menu, not appear in dock, run in background.
Dear Kiel and Kyle, thanx for answers and sorry for repeating the question. It was my first objc code. yours, pg ___ 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
Core Data design patterns
Let's say I have the usual Employee and Department entities. Throughout my application I have to do fetching. I have simplified my code by making a helper class called CoreDataHelper, which has all kinds different helper methods, such as +(NSArray *)employeesInDepartment:(NSManagedObject*)department inManagedObjectContext:(NSManagedObjectContext *)moc; And lots of others like it, as per my needs. As you can imagine, the list will grow with time as I need to do different types of fetching around my app, and as I add more entities. The advantage of using this method is that I save myself a lot of NSFetchRequest *fetchRequest = ... type of code lines throughout my app. On the other hand, a possible drawback is that I might be breaking some design principles. If this is the case, can you tell me why this is bad? In fact, I can think of another variation of my method. Namely, to not have class methods in CoreDataHelper, but rather instance methods and initialize the CoreDataHelper with the MOC. The advantage of this would be that I would not have to pass the MOC into each method call. The drawback is that I have to create a CoreDataHelper instance each time I want to use its methods. A third variation would be to simply do either of the two variations above, but not pass in MOC anywhere and instead just use [[NSApp delegate] managedObjectContext] whenever I need it within CoreDataHelper. But I believe this third variation is plain bad as it relies on some special app delegate to be present, making a model object be depended on a controller object, breaking the MVC guidelines. What do you guys think? How would you do this stuff? A more general closing question: How do you make your code more organized? It's just that I've been typing these thousands of lines of code and all this time I've had this strange feeling that there is just something awful about my code, but without knowing what exactly is wrong. For instance, I've gotten to the point where lots of model/controller/view code, which should be separated somehow by MVC, are mixed together. Not completely mixed of course, I try to think of MVC and have some separation with respect to that, but there is still some mixup here and there. At least that's what I feel. The thing is just, I can't always see clearly how I would make the separation. Making me feel a bit bad. Any antidotes? Maybe reading some good design principles book will help? Or getting a degree in CS? How did you guys learn this stuff? -. _ Invite your mail contacts to join your friends list with Windows Live Spaces. It's easy! http://spaces.live.com/spacesapi.aspx?wx_action=createwx_url=/friends.aspxmkt=en-us___ 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: [Job] Cocoa developer at Skype (Mac/iPhone)
I think that Apple listens too much to ATT. One of my mobile operator in fact promote Skype and the two other ones allow Skype on their networks. Anyway, this is far off-topic for this list. On 18 Jul 2009, at 01:18, William Squires wrote: Not sure this'll get anywhere. IIRC, Apple expressly forbids VOIP apps on the iPhone platform... On Jul 8, 2009, at 11:34 AM, Janno Teelem wrote: Hello, Looking for an experienced Cocoa developer to join our Mac and iPhone development team. You will be working on the Mac and/or iPhone versions of Skype. Ideal candidate should be very familiar with application design, user interface implementation and have a strong understanding of Objective-C and Cocoa. Candidate should have demonstrated creative and critical thinking capabilities. Must be self-motivated and able to work well in a team environment. Pre-requisite Knowledge, Skills and Experience: * 5 years of professional software development experience. * Proven track record of delivering complex application software. * World-class skills in Objective-C and Cocoa. * Should have a strong knowledge of multithreaded programming, asynchronous and event driven application design. * Should be well disciplined in the application development processes of requirements analysis, functional spec development, prototyping, implementation, testing, documentation and maintenance. Values: * Goal-oriented. * Fast and effective. * Respectful and honest. * Early adopter of new technologies. * Positive attitude toward working in an environment of frequently changing requirements. Location: Tallinn (Estonia), Stockholm (Sweden), London (UK), so this position is based in Europe. If you're interested or know someone that might be, email j...@skype.net (Ref: COCOA-DEV-EE) or contact me via Skype, username janno_teelem Best regards, Janno Teelem ___ 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/wsquires%40satx.rr.com This email sent to wsqui...@satx.rr.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/robert%40synapsetech.co.uk This email sent to rob...@synapsetech.co.uk ___ 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:missing vertical scroll bar
I've satisfied myself that trying to use IB which is essentially a bind-at-compile-time approach is a pita when trying to deal with an execution-time-specified number of windows which must accommodate a tab view which must accommodate a workspace (text view imbedded in a scroll view), the size of which is run-time-specified. If I can't create an object programmatically using the documented class interfaces then I think one of the following is true: 1)The documentation is incomplete or incorrect 2)The public class interface is insufficient 3)There is a bug in the framework 4)I have missed or misunderstood something, or did a boo-boo in my code (I'll accept that as the most likely). In any case, something needs to be fixed, or I need to be shown what I'm doing wrong. Dale Miller dalelmil...@cableone.net ___ 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: missing vertical scroll bar
The topic of creating a Cocoa app without using IB has come up many times since I've been on this list, and the general opinion is you should always use IB unless you've got a really good reason not to. IB's not a toy, it doesn't make you any less of a programmer, it's not going anywhere, and it's just how we do things. :) You may struggle with IB in the beginning, but give it an honest effort and you'll find yourself writing less code and better software. Perhaps you could give a detailed description of what your UI should look like, and we can tell you the IB way to do it? Nothing of what you've mentioned so far is beyond the abilities of IB. Some notes: o execution-time-specified number of windows: This makes me think you need a document-based app. Also check out NSWindowController. o text view imbedded in a scroll view: In IB, any text view is by default embedded in a scroll view, no code necessary. Yay. David ___ 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: missing vertical scroll bar
On Jul 18, 2009, at 01:18, Dale Miller wrote: I've satisfied myself that trying to use IB which is essentially a bind-at-compile-time approach is a pita when trying to deal with an execution-time-specified number of windows which must accommodate a tab view which must accommodate a workspace (text view imbedded in a scroll view), the size of which is run-time-specified. If I can't create an object programmatically using the documented class interfaces then I think one of the following is true: 1)The documentation is incomplete or incorrect 2)The public class interface is insufficient 3)There is a bug in the framework 4)I have missed or misunderstood something, or did a boo-boo in my code (I'll accept that as the most likely). In any case, something needs to be fixed, or I need to be shown what I'm doing wrong. a. It's #4. Possibly with a tiny bit of #1. It really is possible to create windows and views programmatically. There is no bug in the framework. (At least, you'd have to *prove* that there is. These NSView APIs have been tried and tested countless times.) b. You'll likely have trouble getting expert help on this, because the expert help on this list will likely think it's waste of time to do it programmatically. c. A far better approach is to use IB to create the pieces you want to assemble at run time, each as a separate view subtree, probably but not necessarily in a separate NIB file. Then you have only two things to do at run time: add the subtrees to your window's view hierarchy (which is very easy), and resize the subtrees you add to your window's view hierarchy (sometimes fiddly, but writing code to resize views is much easier than constructing the views). If you've set the autoresizing up right in your NIBs, then often all that's necessary is to resize the subtree root view to fit view it's becoming part of, and everything else just happens automatically. d. Debugging hand-constructed views is a much bigger PITA than pretty much any way of doing it that involves IB. e. Notwithstanding a-d, your app *may* have a valid reason for doing this the hardest way, but if so we haven't heard it yet. FWIW. ___ 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
iPhone runtime browser.
For anyone who hasn't done it themselves already, I just wrote up a little Cocoa touch app that shows you all the classes in the objective- C runtime. No point in submitting it to the app store, but if anyone would like a copy, drop me a note and I'll mail it to you. It's a 36KB .zip file. Offered as-is, no help, no support, no guarantees, etc. -jcr This is not a book to be tossed aside lightly. Rather, it should be hurled with great force. -Dorothy Parker ___ 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: iPhone runtime browser.
Oop, forgot to add: send requests to me, not the list. -jcr “The two most important tools an architect has are the eraser in the drawing room and the sledge hammer on the construction site. ” -Frank Lloyd Wright ___ 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
Where to release in UIView
I've got a UIView object that uses an NSDictionary. The UIView is instantiated from a nib, so I initialise the dictionary in awakeFromNib, since the initWithFrame: method is never called. Is it appropriate to release this dictionary in the UIView dealloc method? dkj ___ 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: Where to release in UIView
On 18 Jul 2009, at 9:59 AM, DKJ wrote: I've got a UIView object that uses an NSDictionary. The UIView is instantiated from a nib, so I initialise the dictionary in awakeFromNib, since the initWithFrame: method is never called. Is it appropriate to release this dictionary in the UIView dealloc method? How did you create the NSDictionary? Do you declare a property or accessor methods for the instance variable? Did you use them? If a property, does it have the copy or retain attributes? Show your declaration and initialization code. — F -- Fritz Anderson -- Xcode 3 Unleashed: Now in its second printing -- http://x3u.manoverboard.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: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: Where to release in UIView
On 18-Jul-09, at 8:08 , Fritz Anderson wrote: How did you create the NSDictionary? Do you declare a property or accessor methods for the instance variable? Did you use them? If a property, does it have the copy or retain attributes? Show your declaration and initialization code. This is what I have in awakeFromNib shadingAreas = [[NSDictionary alloc] initWithObjectsAndKeys: SaM, @SaM, SeM, @SeM, nil]; Which leads to my next question: The objects in this dictionary are CGMutablePathRefs. How should I wrap these for the dictionary? As NSValues, using valueWithPointer:? dkj ___ 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
Loading GC test bundles
Hi, I'm the developer of a GUI for OCUnit called OCRunner. I'm having an issue with loading test bundles that use GC into the app. It brings up the following error: 18/07/2009 2:37:05 pm OCRunnerTool[9566] Error loading /Test/Binary/ Path: dlopen(/Test/Binary/Path, 265): no suitable image found. Did find: /Test/Binary/Path: GC capability mismatch This appears for both my foundation tool which runs the test (OCRunnerTool) and the GUI app that displays the results (OCRunner). Both these run fine except they show no tests run, probably due to the bundle simply not being loaded. At first I thought the problem was that GC was set as unsupported on both of these targets but setting it to either supported or required brings up the same issue. I've looked around but the only thing I've found relating to OCUnit and GC is something about framework tests running with GC required not being supported in Xcode 3.0. The tests run fine using the default run tool included with the dev tools. The project is open source and the source can be found at: http://bazaar.launchpad.net/~pilky/ocrunner/dev/files . Hopefully a different pair of eyes (possibly one with more experience with unit testing with GC) might be able to see something I'm missing. The code that deals with running tests is /OCRunnerTool and AppDelegate.m:102-166. Thanks - Martin Pilkington Writer of Weird Symbols pi...@mcubedsw.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: NSTextView without NSScrollView
On Jul 17, 2009, at 5:38 PM, James Walker wrote: Is there a way to have an NSTextView that is not enclosed in an NSScrollView? IB doesn't seem to want to let me. It would be for displaying static rich text (certain things are harder, or maybe even impossible, to do with NSTextField). I know I can turn off drawing of the NSScrollView border, but it throws off the layout, because there's a margin around the text, at least on the left. I do this in an app I am working on. I do *not* create the NSTextView in IB, but rather do so programmatically. You'll need to call its - initWithFrame method to initialize, and then add as a subview to its containing view. I also interact directly with the underlying text system (Text Container, Layout Manager, and Text Storage) in order to set the text, determine the size of the laid out text, and position for presentation and interaction. Getting all that to work took me a fair amount of exploration and reading of the relevant class documentation and other text-related information provided by Apple. ___ 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: Where to release in UIView
On 18 Jul 2009, at 10:16 AM, DKJ wrote: On 18-Jul-09, at 8:08 , Fritz Anderson wrote: How did you create the NSDictionary? Do you declare a property or accessor methods for the instance variable? Did you use them? If a property, does it have the copy or retain attributes? Show your declaration and initialization code. This is what I have in awakeFromNib shadingAreas = [[NSDictionary alloc] initWithObjectsAndKeys: SaM, @SaM, SeM, @SeM, nil]; Which leads to my next question: The objects in this dictionary are CGMutablePathRefs. How should I wrap these for the dictionary? As NSValues, using valueWithPointer:? You have to release shadingAreas. You alloc'ed it, you own it. My understanding is that the opaque CG types are all CFType objects (a skim of CGPath.h confirms this for CGPathRef), and that the managed- object methods work on CFTypes. NSDictionary retains its value objects. Assuming you don't want access to SaM and SeM independent of the dictionary, call CGPathRelease on both of them once the dictionary has them. They'll stick around till you release the dictionary. — F ___ 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
Custom NSArrayController - Dynamic Class?
I have a Core Data app and several tables for adding various entities. I want to add an index to each new object so I can sort them after fetching. I've been using a custom NSArrayController and overriding the addObject:, insertObject: atArrangedObjectIndex:, and removeObject: methods to add or update the indices as I go, using, for example: - (void)addObject:(Floor *)object { [super addObject:object]; object.index = [NSNumber numberWithInt:[[self arrangedObjects] indexOfObject:object]]; NSLog(@Added %@, [object description]); } This means that I need a custom NSArrayController for each entity. Is there a way to make the entity name dynamic? In other words, can I ask the array controller for the name of the entity it's managing, so I only need one custom NSArrayController subclass to manage this for several different entity types? I guess I'm looking for a way to replace the argument (Floor *) from the example above with something like: [[[self arrangedObjects] objectAtIndex:0] class] If I use id, the code doesn't know that the object being added should have an index. Thanks. Brad ___ 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: Custom NSArrayController - Dynamic Class?
On Jul 18, 2009, at 09:01, Brad Gibbs wrote: This means that I need a custom NSArrayController for each entity. Is there a way to make the entity name dynamic? In other words, can I ask the array controller for the name of the entity it's managing, so I only need one custom NSArrayController subclass to manage this for several different entity types? I guess I'm looking for a way to replace the argument (Floor *) from the example above with something like: [[[self arrangedObjects] objectAtIndex:0] class] Perhaps NSSClassFromString ([[self entityName] managedObjectClassName])? ___ 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: Finding an available port for chat
It sounds like it would just be easier to do sudo chat with a php script under my current available tools. On Jul 17, 2009, at 7:20 PM, glenn andreas wrote: On Jul 17, 2009, at 9:08 PM, Development wrote: I'm not trying to skirt around rules. Yahoo chat works on my machine, So did msn years back when I had it and so does teamspeak and ventrilo so I know there are ports out there that are free to be used I'm just not sure how to go about choosing one or if I should just hard code it. It's not a file exchange program just text chat and the two iPhones will communicate directly with each other rather than through my server since frankly I have high bandwidth demands as is. That and I cannot run a chat server daemon on the server since it's shared hosting rather than dedicated. (As a nearly identical question asked less that a week ago - seriously, do some searching to turn up a wealth of suggestions and comments...): In general, this will only work if the two phones are on the same local network (such as on the wifi). If that's the case, you can just use Bonjour for discovery and it will handle assigning port number. Otherwise, for example, if the two devices are using 3G to connect to the internet, even if they are set up to accept connections, the cell network NAT will disallow incoming connections. More complicated approaches (google tcp hole punching or NAT Traversal) are needed for that (and I'm not sure that those techniques will work across cell networks). You can, however, have both devices connect to the same remote server, and have it forward packets between them, but that approach does not scale well. You're really going to have to do some more research on networking and peer-to-peer connections to understand the ramifications of trying to have one random device talk to another random device. Glenn Andreas gandr...@gandreas.com http://www.gandreas.com/ wicked fun! Mad, Bad, and Dangerous to Know ___ 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
NSPasteboard and data types
Hi everyone, I'm playing around with NSPasteboard in 10.5 and want to basically create a copy of the generalPasteboard. I've got two classes: DDPasteboard and DDPasteboardItem. DDPasteboard has a to-many relationship with DDPasteboardItem. What I'm wondering is this: do I need to have separate string and data properties in DDPasteboardItem? I see that I can grab stringForType: and dataForType: from the pasteboard, but what's the difference between them (other than one returning an NSString and the other an NSData)? In the documentation I see that stringForType: just invokes dataForType:, but is there ever an instance where stringForType: would return something different than can be inferred from dataForType:? Thanks, Dave DeLong ___ 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: Where to release in UIView
On 18-Jul-09, at 8:50 , Fritz Anderson wrote: You have to release shadingAreas. You alloc'ed it, you own it. Yes, I realise that. What I'm wondering is where to do it, since it's initialised in the awakeFromNib method, rather than in initWithFrame:. The NSDictionary does store the CGMutablePathRefs quite nicely, although the compiler complains about it. dkj ___ 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: Where to release in UIView
On Jul 18, 2009, at 1:09 PM, DKJ wrote: On 18-Jul-09, at 8:50 , Fritz Anderson wrote: You have to release shadingAreas. You alloc'ed it, you own it. Yes, I realise that. What I'm wondering is where to do it, since it's initialised in the awakeFromNib method, rather than in initWithFrame:. You really should read up on memory management. It does not matter where you created that object. If your view will own that object, it should release it in dealloc. ___ Ricky A. Sharp mailto:rsh...@instantinteractive.com Instant Interactive(tm) http://www.instantinteractive.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: Where to release in UIView
There is no difference between initing them in initWithFrame and awakeFromNib. You would release them in the same location. if they need to be around for the life time of the view then release them dealloc. If not call release before you leave awakeFromNib... Scott Andrew On Jul 18, 2009, at 11:09 AM, DKJ wrote: On 18-Jul-09, at 8:50 , Fritz Anderson wrote: You have to release shadingAreas. You alloc'ed it, you own it. Yes, I realise that. What I'm wondering is where to do it, since it's initialised in the awakeFromNib method, rather than in initWithFrame:. The NSDictionary does store the CGMutablePathRefs quite nicely, although the compiler complains about it. dkj ___ 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/scottandrew%40roadrunner.com This email sent to scottand...@roadrunner.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: Where to release in UIView
DKJ wrote: Yes, I realise that. What I'm wondering is where to do it, since it's initialised in the awakeFromNib method, rather than in initWithFrame:. It doesn't matter where it's initialized. The only thing that matters is who owns it. It is not only possible, but fairly common, for an instance of some class to acquire ownership of additional objects over time. As a simple example, consider an instance of NSMutableArray. In order for it to work properly, it acquires ownership of every object added or inserted. So ask yourself what should the dealloc method of NSMutableArray do? The answer should be obvious: it should release every object it still owns, regardless of when the object was acquired. You should probably reread the Memory Management section if this isn't crystal-clear. I'm not just being pedantic about this, either. Ownership is *the* fundamental principle behind all questions of memory management, and if there is any question in your mind about what ownership means or what its responsibilities are, then rereading the memory management docs is the best thing to do. The NSDictionary does store the CGMutablePathRefs quite nicely, although the compiler complains about it. Post the error message. ___ 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: Custom NSArrayController - Dynamic Class?
On Jul 18, 2009, at 10:36, Brad Gibbs wrote: Can I use that to indicate the type for the argument to the method? On Jul 18, 2009, at 9:45 AM, Quincey Morris wrote: Perhaps NSSClassFromString ([[self entityName] managedObjectClassName])? Sorry, I took your example too literally, and gave you the expression for the class name (apart from the typo). For insertNewObjectForEntityForName:inManagedObjectContext: you'd just need the entity name: insertNewObjectForEntityForName: [self entityName] inManagedObjectContext: [self managedObjectContext] Is that what you wanted? ___ 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: Where to release in UIView
Thanks to all who replied. I was concerned whether the object might somehow get re-instantiated from the nib without dealloc being called first. If I understand memory management correctly, that would produce a leak. I'm assuming that the object wouldn't be re-instantiated without its previous instantiation being released. But I'd sleep better having an expert opinion. dkj On 18-Jul-09, at 7:59 , DKJ wrote: I've got a UIView object that uses an NSDictionary. The UIView is instantiated from a nib, so I initialise the dictionary in awakeFromNib, since the initWithFrame: method is never called. Is it appropriate to release this dictionary in the UIView dealloc method? dkj ___ ___ 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
NSDateFormatter issue (bug maybe)?
Hi All, Thanks in advance for any help on this issue. I have a file that uses the following format for date and times: (4 digit year)-(2 digit month)-(2 digit day)T(2 digit hour, 0-23):(2 digit minute):(2 digit seconds)-(4 digit offset from GMT) Example: 2009-07-17T17:12:20-0700 I am using an NSDateFormatter with a custom date format to read these dates. formatter = [[NSDateFormatter alloc] init]; [formatter setFormatterBehavior:NSDateFormatterBehavior10_4]; [formatter setDateFormat:@-MM-dd'T'HH:mm:ssZZZ]; On the Mac this works great for any combination of Region setting and 24hr/AM,PM settings. On the iPhone (both iPhone OS 2.2.1 and 3.0) this does not work if the Region setting is set to something that defaults to 24hr time (like UK, France, and Thai) but the time display setting is set by the user to AM/PM. For example: on the iPhone if in Settings you set the region to UK and turn 24-Hour Time off. When the phone is configured like this the above code wants to read and write dates with the following format. (4 digit year)-(2 digit month)-(2 digit day)T(2 digit hour, 0-23):(2 digit minute):(2 digit seconds) (AM/PM)-(4 digit offset from GMT) Example: 2009-07-17T17:12:20 PM-0700 This is not the behavior I would have expected. Am I configuring NSDateFormatter correctly? Is this a bug I should file in Radar? Again any help is greatly appreciated. We have an app in the App Store with this issue and it is causing some customers issues. Thanks, James ___ 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: Where to release in UIView
DKJ wrote: Thanks to all who replied. I was concerned whether the object might somehow get re-instantiated from the nib without dealloc being called first. If I understand memory management correctly, that would produce a leak. I'm assuming that the object wouldn't be re-instantiated without its previous instantiation being released. But I'd sleep better having an expert opinion. Work it through. If you understand ownership, you already have all the expertise needed. Can awakeFromNib be called more than once on the same instance? If so, then in awakeFromNib you need to account for the possibility of shadingAreas already holding a non-nil (hence, an owned) NSDictionary instance. The reason is simple: you own that non-nil instance. What should you do if you discover a non-nil shadingAreas in awakeFromNib? It depends on you and your design. You could use the existing instance, if that makes sense. You could release the existing instance and alloc/init a new one, if that makes sense. You could trigger an assertion that fails if this happens, it that makes sense. None of this has any bearing on what you'd do with shadingAreas in dealloc. You have to consider ownership in each method separately. -- GG ___ 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: iPhone runtime browser.
Couple of notes: I built it for the 3.1 SDK, and I didn't try it on anything earlier. One friend of mine told me that to make it work on the 3.0 SDK, he had to change line 31 of ClassesViewController.m from: [self.tableView reloadData]; to [super.tableView reloadData]; -jcr ___ 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: NSPasteboard and data types
Great, that's what I needed to know. =) Dave On Jul 18, 2009, at 12:40 PM, Michael Hoy wrote: Dave, I've worked with UIPasteboard, which I'm assuming is similar. dataForType: will contain string data if it's a type such as UTF8 text. My own PasteboardItem class had just data (NSData) and type (NSString) properties, and it's worked fine for everything. Once you have the type and data, you can then write methods to convert to strings or whatnot. Michael Hoy michael.john@gmail.com On Jul 18, 2009, at 1:52 PM, Dave DeLong wrote: Hi everyone, I'm playing around with NSPasteboard in 10.5 and want to basically create a copy of the generalPasteboard. I've got two classes: DDPasteboard and DDPasteboardItem. DDPasteboard has a to-many relationship with DDPasteboardItem. What I'm wondering is this: do I need to have separate string and data properties in DDPasteboardItem? I see that I can grab stringForType: and dataForType: from the pasteboard, but what's the difference between them (other than one returning an NSString and the other an NSData)? In the documentation I see that stringForType: just invokes dataForType:, but is there ever an instance where stringForType: would return something different than can be inferred from dataForType:? Thanks, Dave DeLong ___ 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/michael.john.hoy%40gmail.com This email sent to michael.john@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: Loading GC test bundles
18/07/2009 2:37:05 pm OCRunnerTool[9566] Error loading /Test/Binary/ Path: dlopen(/Test/Binary/Path, 265): no suitable image found. Did find: /Test/Binary/Path: GC capability mismatch You'll need the process to be running in the appropriate memory management mode to load a bundle, or the bundle must support the mode of memory management the application has started in. Or you must restart the process in the appropriate mode. This is not usually a good idea; but you can set or unset the OBJC_DISABLE_GC environment variable and then re-exec the process. Keith ___ 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: Custom NSArrayController - Dynamic Class?
Not exactly. Sorry I've done such a poor job describing what I'm after. I've got an entity named Building (and also entities named Floor and Room). Each of these entities has an index attribute, which is an int16 type. All three entities inherit the index attribute and others from a common parent, which I'm calling IndexedObject. The UI has tables for each entity and '+' and '-' buttons to add and remove entities from the table and drag-and-drop to reorder the entities. The '+' button is linked to the NSArrayController subclass' add: method, which automatically invokes insertNewObjectForEntityForName: inManagedObjectContext:. I've been using: - (void)addObject:(Building *)object { [super addObject:object]; object.index = [NSNumber numberWithInt:[[self arrangedObjects] indexOfObject:object]]; NSLog(@Added %@, [object description]); } to override NSArrayController's standard implementation and assign an index to the newly-created object, based on its index within the underlying array. The problem is the type for the argument in the method declaration. With the standard method signature: - (void)addObject:(id)object the runtime doesn't have a specific entity to look to for a definition, so it doesn't know that I really want to be adding a Building entity, which does have an index attribute, and it throws an error. If I change the method declaration to: - (void)addObject:(Building *)object it knows that the Building entity has an index attribute, so the error goes away. But, that means that I need to create separate NSArrayController subclasses to control the arrays of the Floor and Room entities. I'm hoping to find a method declaration that can look to the entity type of the objects that the array controller is controlling (as set in IB), so that I can use the same subclass for the Building, Floor and Room arrays. Having separate NSArrayController subclasses for Floor and Room isn't the end of the world, but if there's a cleaner way to do this, I'd like to learn about it. Thanks for all of your help. Brad On Jul 18, 2009, at 12:24 PM, Quincey Morris wrote: On Jul 18, 2009, at 10:36, Brad Gibbs wrote: Can I use that to indicate the type for the argument to the method? On Jul 18, 2009, at 9:45 AM, Quincey Morris wrote: Perhaps NSSClassFromString ([[self entityName] managedObjectClassName])? Sorry, I took your example too literally, and gave you the expression for the class name (apart from the typo). For insertNewObjectForEntityForName:inManagedObjectContext: you'd just need the entity name: insertNewObjectForEntityForName: [self entityName] inManagedObjectContext: [self managedObjectContext] Is that what you wanted? ___ 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/bradgibbs%40mac.com This email sent to bradgi...@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: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: missing vertical scroll bar
On Sat, Jul 18, 2009 at 1:18 AM, Dale Millerdalelmil...@cableone.net wrote: I've satisfied myself that trying to use IB which is essentially a bind-at-compile-time approach is a pita when trying to deal with an execution-time-specified number of windows which must accommodate a tab view which must accommodate a workspace (text view imbedded in a scroll view), the size of which is run-time-specified. IB is not a bind-at-compile-time approach. I'm really not even sure what that means in this context. Yes, you're creating objects and playing around with them before freezing them at compile time, but they're all unfrozen using -initWithCoder: or other well-defined initialization mechanisms at runtime, at which point they're normal objects. Perhaps you need to overcome this mental hurdle? Interface Builder is, simply put, How It's Done. --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: Custom NSArrayController - Dynamic Class?
On Jul 18, 2009, at 14:35, Brad Gibbs wrote: - (void)addObject:(Building *)object { [super addObject:object]; object.index = [NSNumber numberWithInt:[[self arrangedObjects] indexOfObject:object]]; NSLog(@Added %@, [object description]); } to override NSArrayController's standard implementation and assign an index to the newly-created object, based on its index within the underlying array. The problem is the type for the argument in the method declaration. With the standard method signature: - (void)addObject:(id)object the runtime doesn't have a specific entity to look to for a definition, so it doesn't know that I really want to be adding a Building entity, which does have an index attribute, and it throws an error. If I change the method declaration to: - (void)addObject:(Building *)object it knows that the Building entity has an index attribute, so the error goes away. But, that means that I need to create separate NSArrayController subclasses to control the arrays of the Floor and Room entities. I'm hoping to find a method declaration that can look to the entity type of the objects that the array controller is controlling (as set in IB), so that I can use the same subclass for the Building, Floor and Room arrays. Oh, I get it now. The error you're getting is nothing to do with the runtime. The type of the parameter variable is a compile time matter only. If IndexedObject is the superclass of Building, Floor and Room, you can take care of this at compile time: - (void)addObject:(IndexedObject *)object { [super addObject:object]; object.index = [NSNumber numberWithInt:[[self arrangedObjects] indexOfObject:object]]; } If it's just an entity with no custom class, you have to just make the compiler stop complaining: - (void)addObject:(id)object { [super addObject:object]; [object performSelector: @selector (setIndex:) withObject: [NSNumber numberWithInt:[[self arrangedObjects] indexOfObject:object]]]; } Either way, you only need one NSArrayController subclass for all 3 cases. If you wish, you can add a check that the passed object is of the correct class or entity. Incidentally, it would be slightly more correct to use NSNumber numberWithUnsignedInteger -- because indexOfObject: actually returns a NSUInteger value, which is unsigned, and which is 64 bits in a 64-bit app. This is not going to be a problem unless you have more than 2 billion objects, but it's good to be prepared. :) ___ 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: Custom NSArrayController - Dynamic Class?
On Sat, Jul 18, 2009 at 2:58 PM, Quincey Morrisquinceymor...@earthlink.net wrote: [object performSelector: @selector (setIndex:) withObject: [NSNumber numberWithInt:[[self arrangedObjects] indexOfObject:object]]]; I would instead recommend using -setValue:forKey: like this: [object setValue:[NSNumber numberWithInteger:[[self arrangedObjects] indexOfObject:object]] forKey:@index] Also note that I'm using +numberWithInteger:, not +numberWithInt. --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: Custom NSArrayController - Dynamic Class?
On Jul 18, 2009, at 15:07, Kyle Sluder wrote: I would instead recommend using -setValue:forKey: like this: [object setValue:[NSNumber numberWithInteger:[[self arrangedObjects] indexOfObject:object]] forKey:@index] Yes, it's more sensible. But now that I think about it, the performSelector approach has one *slight* advantage to the developer. If you ever use Xcode's refactoring to change the name of the property, it will miss the property name in the string. With @selector, the method name still doesn't change, but the refactor window does give a warning that it's not going to change automatically. Perhaps the best option is option (c): create a IndexedObject abstract superclass (if there isn't one already) and use 'object.index = ...' after 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: Loading GC test bundles
GC is opt in on a per-process rather than per-binary basis. Thus in order to load a GC bundle, OCRunnerTool needs to be built at least GC-supported and running under GC. You'll need to determine in advance whether to run tests GC or not, and then invoke OCRunnerTool with the appropriate environment variable set to disable GC when not. -- Chris On Jul 18, 2009, at 8:18 AM, Martin Pilkington pi...@mcubedsw.com wrote: Hi, I'm the developer of a GUI for OCUnit called OCRunner. I'm having an issue with loading test bundles that use GC into the app. It brings up the following error: 18/07/2009 2:37:05 pm OCRunnerTool[9566] Error loading /Test/Binary/ Path: dlopen(/Test/Binary/Path, 265): no suitable image found. Did find: /Test/Binary/Path: GC capability mismatch This appears for both my foundation tool which runs the test (OCRunnerTool) and the GUI app that displays the results (OCRunner). Both these run fine except they show no tests run, probably due to the bundle simply not being loaded. At first I thought the problem was that GC was set as unsupported on both of these targets but setting it to either supported or required brings up the same issue. I've looked around but the only thing I've found relating to OCUnit and GC is something about framework tests running with GC required not being supported in Xcode 3.0. The tests run fine using the default run tool included with the dev tools. The project is open source and the source can be found at: http://bazaar.launchpad.net/~pilky/ocrunner/dev/files . Hopefully a different pair of eyes (possibly one with more experience with unit testing with GC) might be able to see something I'm missing. The code that deals with running tests is /OCRunnerTool and AppDelegate.m:102-166. Thanks - Martin Pilkington Writer of Weird Symbols pi...@mcubedsw.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/cmh%40me.com This email sent to c...@me.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: [IB] - how to delete action or outlet?
Nice! And how to remove that action or at least how to rename it? For example I've done it by mistake, for testing or similar purposes. Now I can't remove such action or outlet, though I've closed IB, removed the action from the source file, then opened IB again. The action (or outlet) still exists in the object properties list. I think the only way to remove it is to edit XIB file manually - not a simple way, isn't it? Once you have removed from source files and saved, then in the inspector panel, on the connections tab, you can click to remove... -- Scott Ribe scott_r...@killerbytes.com http://www.killerbytes.com/ (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: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Maybe I've misunderstood something
Ok I can add a badge to my application icon on iphone. why? In 3.0 did they make it so that my app could perform tasks when it was not running and I missed the tech note? What is the practical use for this if you are not Apple inc? ___ 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: Maybe I've misunderstood something
Does your app have a reason to display a number on the icon? A couple different apps on my phone display it for: * To-do app showing the number of items remaining to be done * Calendar app showing the number of birthdays coming up AFAIK, all that 3.0 added was the ability to set the badge via Push Notification. It's easy enough to set as the app is exiting. If you don't see a reason to use it, don't use it. Brian On Jul 18, 2009, at 10:45 PM, Development wrote: Ok I can add a badge to my application icon on iphone. why? In 3.0 did they make it so that my app could perform tasks when it was not running and I missed the tech note? What is the practical use for this if you are not Apple inc? ___ 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/brianslick%40mac.com This email sent to briansl...@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: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: [IB] - how to delete action or outlet?
On Sun, Jul 19, 2009 at 11:40 AM, Scott Ribe scott_r...@killerbytes.comwrote: Once you have removed from source files and saved, then in the inspector panel, on the connections tab, you can click to remove... I'm pretty sure once you remove the IBAction/IBOutlet from the header file and save, IB will synchronize ___ 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: [IB] - how to delete action or outlet?
On Jul 18, 2009, at 8:05 PM, KK wrote: On Sun, Jul 19, 2009 at 11:40 AM, Scott Ribe scott_r...@killerbytes.com wrote: Once you have removed from source files and saved, then in the inspector panel, on the connections tab, you can click to remove... I'm pretty sure once you remove the IBAction/IBOutlet from the header file and save, IB will synchronize If the outlet was connected to a view the outlet will still be in the ctl-click pop up but colored red Nope, I checked. It's colored yellow with a mini warning icon replacing the connection circle. The inspector window shows the outlet grayed out. /\/\arc ___ 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: [IB] - how to delete action or outlet?
On Sat, Jul 18, 2009 at 11:05 PM, KK kthem...@gmail.com wrote: On Sun, Jul 19, 2009 at 11:40 AM, Scott Ribe scott_r...@killerbytes.com wrote: Once you have removed from source files and saved, then in the inspector panel, on the connections tab, you can click to remove... I'm pretty sure once you remove the IBAction/IBOutlet from the header file and save, IB will synchronize You might have to hit File Reload All Class Files in IB if it doesn't notice right away. -- Ben ___ 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: Maybe I've misunderstood something
This all depends on the type of app you are. There are a couple of non 3.0 examples that are good. Rolando uses to show the number of Rolandos are left to be saved, if you are interrupted mid level. Skype shows then number of open conversations. These are two of the non-push non-apple examples that strike me. Sent from my iPhone On Jul 18, 2009, at 7:45 PM, Development developm...@fornextsoft.com wrote: Ok I can add a badge to my application icon on iphone. why? In 3.0 did they make it so that my app could perform tasks when it was not running and I missed the tech note? What is the practical use for this if you are not Apple inc? ___ 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/scottandrew%40roadrunner.com This email sent to scottand...@roadrunner.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: Where to release in UIView
That actually is a valid concern; since you're on the iPhone, memory constraints are tight, and your view may actually be unloaded at some point. Instead of doing additional initialization in awakeFromNib, (which has no counterpart), I'd recommend doing your additional setup in viewDidLoad: on the associated UIViewController. Then, in viewDidUnload: you can release anything you instantiated in viewDidLoad:. Note that viewDidUnload is only available in iPhone OS 3.0 and later. -BJ On Sat, Jul 18, 2009 at 1:56 PM, DKJ hatzicw...@shaw.ca wrote: Thanks to all who replied. I was concerned whether the object might somehow get re-instantiated from the nib without dealloc being called first. If I understand memory management correctly, that would produce a leak. I'm assuming that the object wouldn't be re-instantiated without its previous instantiation being released. But I'd sleep better having an expert opinion. dkj On 18-Jul-09, at 7:59 , DKJ wrote: I've got a UIView object that uses an NSDictionary. The UIView is instantiated from a nib, so I initialise the dictionary in awakeFromNib, since the initWithFrame: method is never called. Is it appropriate to release this dictionary in the UIView dealloc method? dkj ___ ___ 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/bjhomer%40gmail.com This email sent to bjho...@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: Custom NSArrayController - Dynamic Class?
On Sat, Jul 18, 2009 at 4:23 PM, Quincey Morris quinceymor...@earthlink.net wrote: On Jul 18, 2009, at 15:07, Kyle Sluder wrote: I would instead recommend using -setValue:forKey: like this: [object setValue:[NSNumber numberWithInteger:[[self arrangedObjects] indexOfObject:object]] forKey:@index] Yes, it's more sensible. But now that I think about it, the performSelector approach has one *slight* advantage to the developer. If you ever use Xcode's refactoring to change the name of the property, it will miss the property name in the string. With @selector, the method name still doesn't change, but the refactor window does give a warning that it's not going to change automatically. Perhaps the best option is option (c): create a IndexedObject abstract superclass (if there isn't one already) and use 'object.index = ...' after all. In order to preserve the contract of NSArrayController (which is that you can add *any* object with addObject:), I'd recommend doing something like this: - (void)addObject:(id)object { if ([object respondsToSelector:@selector(setIndex:)] { object.index = [NSNumber numberWithInt:[[self arrangedObjects] indexOfObject:object]]; } [super addObject:object]; } Note that I call super's addObject: at the end. I have no idea what the implementation of NSArrayController's addObject: is, but it's always better to have things set up before you pass something along to super. Imagine, for example, that NSArrayController writes the object immediately to disk when added. Since you haven't set your index yet, it would be incorrect. (I don't think it actually writes anything to disk at that point, but you get the idea.) -BJ ___ 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: Core Data design patterns
On 2009 Jul 17, at 09:26, Squ Aire wrote: Throughout my application I have to do fetching. I have simplified my code by making a helper class called CoreDataHelper... In fact, I can think of another variation of my method. Namely, to not have class methods in CoreDataHelper, but rather instance methods and initialize the CoreDataHelper with the MOC. The advantage of this would be that I would not have to pass the MOC into each method call. The drawback is that I have to create a CoreDataHelper instance each time I want to use its methods. This is what I've done, except I've taken it a step further. I've created helpers like this for several different entities. Each entity is a subclass of SSYMojo. SSYMojo has a moc and an entity. See my @interface for SSYMojo below. A third variation would be to simply do either of the two variations above, but not pass in MOC anywhere and instead just use [[NSApp delegate] managedObjectContext] whenever I need it within CoreDataHelper. I don't think you want to do that because all ^real^ Core Data apps, sooner or later, end up having multiple mocs. A more general closing question: How do you make your code more organized? ... Any antidotes? I believe you mean anecdotes. To avoid disorganized code, sit down with a pencil and big piece of paper, or a diagramming tool like OmniOutliner, and draw some class diagrams and flow charts. I've heard that some people even do this before they start on a project :)) The Holy Grail is to write a software specification which lays out everything so perfectly that you can hand it to a chimpanzee to write the code. In practice, there's always alot of back-and-forth between the spec and the code, and in the interest of getting the job done before the market moves on, you'll tend to write specs and diagrams for the more difficult parts, but just write code for the easy parts that you've had prior experience with. It's always a tradeoff between spending the time up front to plan and diagram, versus the risk of having to go back and do it later and rewrite code if your intuition turned out to be insufficient. Maybe reading some good design principles book will help? Great. Or getting a degree in CS? Wonderful if you've got the time. How did you guys learn this stuff? The hard way, except it's not learn, it's learning ;) --- #import Cocoa/Cocoa.h #import SSYErrorHandler.h /*! @briefA class for putting and fetching -- managing -- managed objects of a particular entity in a particular managed object context. @details I wanted to make this a subclass of NSManagedObjectContext. However, the documentation for NSManagedObjectContext says that you are highly discouraged from subclassing it. So, what I did instead was to make this class be a wrapper around an managed object context which is an instance variable. */ @interface SSYMojo : NSObject { NSManagedObjectContext* managedObjectContext ; NSString* entityName ; NSObject SSYErrorHandler * errorHandler ; } /*! @briefThe built-in managed object context which the receiver will use. */ @property (retain) NSManagedObjectContext* managedObjectContext ; /*! @briefThe name of the entity of the managed objects which the receiver is expected to manage. */ @property (copy) NSString* entityName ; /*! @briefThe object to which a setError:message will be sent if an error occurs.nbsp; A weak reference.nbsp; Be careful! */ @property (assign) NSObject SSYErrorHandler * errorHandler ; /*! @briefDesignated Initializer for Mojo instances @details managedObjectContext and entityName are required. If either is nil, this method will return nil. @parammanagedObjectContext The managed object context into which objects will be managed. @paramentityName The name of the entity of the objects which will be managed. @result The receiver, or nil if something failed. */ - (id)initWithManagedObjectContext: (NSManagedObjectContext*)managedObjectContext_ entityName:(NSString*)entityName_ errorHandler:(NSObject SSYErrorHandler *) errorHandler_ ; /*! @briefReturns all objects in the receiver's managed object context satisfying given predicates, if any, compounded OR or AND. @paramsubpredicates The array of subpredicates to be compounded @paramtype Either NSAndPredicateType or NSOrPredicateType @result An array of results, or an empty array if no results are found */ - (NSArray*)objectsWithSubpredicates:(NSArray*)subpredicates type:(NSCompoundPredicateType)type ; /*! @briefGets all of the objects in the receiver's managed object context satisfying a given predicate, if any. @details Pass predicate = nil to get all objects related to this extore. @parampredicate The predicate