XC & IB 3.2 overlapping siblings
Folks; I know I'm late to the game here but I just took my app for a compile under XC3.2 for the first time… A few NSString encoding loose ends OK but WHAMO my .xib files are hammered with ~100 errors (not warnings!) ".. This view overlaps one of its siblings. Overlapping sibling views are not supported on Mac OS X versions prior to 10.5. …" My base SDK is set to 10.6 and a deployment of 10.4. Everything was peachy under 10.5 and XC3.1 no such warnings or errors. Sooo does this mean I cannot use XC3.2 unless I fix all these issues? Some are buttons that lie on top of each other and are hidden or shown based on data. How does one avoid the overlapping error in this circumstance? Is there a compiler setting that might be helpful here? This is certainly not what I expected…. Thanks for all input! Steve ___ 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: XC & IB 3.2 overlapping siblings
Nick; Hey thanks for the reply! Yes, I'm aware of the IB target setting. If you still want to target Tiger this is a BIG surprise that these are now treated as errors. The really big question for me is how do you deal with 2 buttons that lie one on top of the other but are never drawn at the same time (setHidden) Do you have to re-jigger everything because IB can't fathom that they might not be visible at the same time? Could you comment on this please - this is a potential real quagmire for me… Steve On Sep 10, 2009, at 10:15 AM, Nick Zitzmann wrote: On Sep 10, 2009, at 2:51 AM, Steve Cronin wrote: My base SDK is set to 10.6 and a deployment of 10.4. Everything was peachy under 10.5 and XC3.1 no such warnings or errors. Sooo does this mean I cannot use XC3.2 unless I fix all these issues? Nib deployment targets are actually set in the nibs, not the project. If you still want to target Tiger, you should fix the errors, since overlapping views are hit-and-miss on Tiger. Alternately, if you want to switch to targeting Leopard, then you can do it by clicking on the info toolbar button in IB and switching the deployment target there. Nick Zitzmann <http://www.chronosnet.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
Snow Leopard and Exchange access using ABAddressBook
Folks; I am trying to understand whether ABAddressBook will permit interaction with Exchange. I don't see anything in the documentation specifically on this point. Can anyone comment on this? Am I missing a resource? Is it currently not supported? Thanks for any thoughts! Steve ___ 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
Developing a Stand-Alone Service in Snow Leopard
Foks; I'm trying to develop a stand alone service in Snow Leopard. The issue I'm running into is how to update the system as I compile a new version. The pbs command shows that the bundle path is the one in my Release Build folder "pbs -dump_pboard" { NSBundleIdentifier = "com.myCompany.myService"; NSBundlePath = "/Volumes/myMacBookPro/Projects/XYZ/Code/ build/Release/MyService.service"; NSKeyEquivalent = { }; NSMenuItem = { default = MyService; }; NSMessage = myService; NSPortName = myServicePort; NSSendTypes = ( NSStringPboardType, NSRTFPboardType, NSTabularTextPboardType ); So when I recompile I do the following: 1) 'Uncheck' the item in the SysPref/Keyboard/Services list 2) Compile a new version 3) run "/System/Library/CoreServices/pbs" 4) 'Check' the item in the SysPref/Keyboard/Services list 5) Test the service by using the context menu (which is appearing at the right time) I have convinced myself that the only way to get Snow Leopard to recognize the newer version of the service is to log out and back in. This is tedious. Is there something I'm missing? Steve ___ 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: Developing a Stand-Alone Service in Snow Leopard
John; That's good information but I don't see how it helps with a stand- alone service - how do I (or user) launch the .service bundle? Steve On Sep 14, 2009, at 1:12 AM, John C. Randolph wrote: On Sep 13, 2009, at 10:55 PM, Steve Cronin wrote: I have convinced myself that the only way to get Snow Leopard to recognize the newer version of the service is to log out and back in. This is tedious. Is there something I'm missing? As I recall, each app builds its services menu when it launches. Any app launched after you run pbs should show a correctly updated services menu. -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: Developing a Stand-Alone Service in Snow Leopard
Folks To clarify my initial problem statement: If I recompile and then issue a "pbs" and then invoke the service it continues to execute an earlier instance of the service -- NOT the freshly compiled instance…. This is easy to prove A set of followup questions on STAND-ALONE services 1) How do I programmatically 'check' the service in System Preferences/ Keyboard/Services? I offer the user the option of installing a service. If they elect to install it seems reasonable that they would want the service engaged. Is the only option to open the System Preferences at the pane? I offer the new shiny; the user says yeah let's use the new groovy stuff; An then I have to say "sorry I can't figure that out for you -- here's a window here's a whole bunch of scary looking text - give it your best shot… (seems pretty lame to me) 2) Since I offer the option to install, I offer the option to uninstall. Is it safe to do this? The .service bundle is marked as open by the system. Is it sufficient to do: if ([[NSFileManager defaultManager] removeFileAtPath:myServicePath handler:self]) NSUpdateDynamicServices(); Thanks for your time and consideration! Steve On Sep 14, 2009, at 1:16 AM, Steve Cronin wrote: John; That's good information but I don't see how it helps with a stand- alone service - how do I (or user) launch the .service bundle? Steve On Sep 14, 2009, at 1:12 AM, John C. Randolph wrote: On Sep 13, 2009, at 10:55 PM, Steve Cronin wrote: I have convinced myself that the only way to get Snow Leopard to recognize the newer version of the service is to log out and back in. This is tedious. Is there something I'm missing? As I recall, each app builds its services menu when it launches. Any app launched after you run pbs should show a correctly updated services menu. -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
Interface Builder .xib deployment/development targets
Folks; I have an app with a 10.4 Deployment target. I have recently begun using XC 3.2 and IB 3.2 - spp compiles cleanly and all IB 'sibling' issues have been resolved. I've gotten a field report (release) where I'm seeing: 15:01:38.292 XYZ[11756:20b] HIToolbox: ignoring exception '*** -[NSCFString substringToIndex:]: Range or index out of bounds' that raised inside Carbon event dispatch This is occurring just as nib is about to open a first window. I've not seen this before and do not see it on my development machines (debug or release) Reporting machine is MacBookPro5,1 - 10.5.8 I have set the app's IB Deployment Target to 10.4 and IB Development Target to IB 3.2 Is there any reason to NOT use IB Development Target of 3.2? Any thoughts on this? It "smells" like its coming from IB not from Cocoa class methods… Steve ___ 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: Interface Builder .xib deployment/development targets
Folks; Got another report today from the field also a MacBookPro5,1 running 10.5.8 2009-09-16 03:01:53.954 XYZ[329:20b] Error loading /Library/ ScriptingAdditions/QXPScriptingAdditions.osax/Contents/MacOS/ QXPScriptingAdditions: dlopen(/Library/ScriptingAdditions/ QXPScriptingAdditions.osax/Contents/MacOS/QXPScriptingAdditions, 262): no suitable image found. Did find: /Library/ScriptingAdditions/QXPScriptingAdditions.osax/Contents/MacOS/ QXPScriptingAdditions: mach-o, but wrong architecture 2009-09-16 03:01:54.150 XYZ[329:20b] HIToolbox: ignoring exception '*** -[NSCFString substringToIndex:]: Range or index out of bounds' that raised inside Carbon event dispatch My released app dies immediately afterwards.. What the heck is going on here? I've compiled the app with XC & IB 3.2 w/ a 10.4 deployment 10.6 SDK (32-bit universal -- i36 ppc ppc7400 ppc970 x86_64) How I do I hone in on where the problem is?? Steve On Sep 15, 2009, at 1:50 AM, Graham Cox wrote: On 15/09/2009, at 4:44 PM, Steve Cronin wrote: 15:01:38.292 XYZ[11756:20b] HIToolbox: ignoring exception '*** -[NSCFString substringToIndex:]: Range or index out of bounds' that raised inside Carbon event dispatch This is occurring just as nib is about to open a first window. I've not seen this before and do not see it on my development machines (debug or release) Reporting machine is MacBookPro5,1 - 10.5.8 Is the report coming from a Snow Leopard machine? I've seen a few of these running on Snow Leopard. My guess is that previously the exception was silently ignored, now it's logging. The exception will still be occurring on 10.4/10.5, just not being noticed. So there is a bug there that you should probably fix. --Graham ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: Interface Builder .xib deployment/development targets
Jonathan; Yeah thanks for asking that - I should have made it clearer. NO crash report - just program death (hang no response) The earlier emails include extracts from my own logs that I have the users turn on. Steve On Sep 16, 2009, at 1:22 PM, Jonathan Hess wrote: On Sep 16, 2009, at 12:46 AM, Steve Cronin wrote: Folks; Got another report today from the field also a MacBookPro5,1 running 10.5.8 2009-09-16 03:01:53.954 XYZ[329:20b] Error loading /Library/ ScriptingAdditions/QXPScriptingAdditions.osax/Contents/MacOS/ QXPScriptingAdditions: dlopen(/Library/ScriptingAdditions/ QXPScriptingAdditions.osax/Contents/MacOS/QXPScriptingAdditions, 262): no suitable image found. Did find: /Library/ScriptingAdditions/QXPScriptingAdditions.osax/Contents/ MacOS/QXPScriptingAdditions: mach-o, but wrong architecture 2009-09-16 03:01:54.150 XYZ[329:20b] HIToolbox: ignoring exception '*** -[NSCFString substringToIndex:]: Range or index out of bounds' that raised inside Carbon event dispatch My released app dies immediately afterwards.. What the heck is going on here? I've compiled the app with XC & IB 3.2 w/ a 10.4 deployment 10.6 SDK (32-bit universal -- i36 ppc ppc7400 ppc970 x86_64) How I do I hone in on where the problem is?? Do you have a crash report? If so, does it have a backtrace of where the exception occurred? Jon Hess Steve On Sep 15, 2009, at 1:50 AM, Graham Cox wrote: On 15/09/2009, at 4:44 PM, Steve Cronin wrote: 15:01:38.292 XYZ[11756:20b] HIToolbox: ignoring exception '*** -[NSCFString substringToIndex:]: Range or index out of bounds' that raised inside Carbon event dispatch This is occurring just as nib is about to open a first window. I've not seen this before and do not see it on my development machines (debug or release) Reporting machine is MacBookPro5,1 - 10.5.8 Is the report coming from a Snow Leopard machine? I've seen a few of these running on Snow Leopard. My guess is that previously the exception was silently ignored, now it's logging. The exception will still be occurring on 10.4/10.5, just not being noticed. So there is a bug there that you should probably fix. --Graham ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/jhess%40apple.com This email sent to jh...@apple.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
Static Analyzer and Core Foundation
Folks; Alert - potential boneheaded-ness lies ahead - please be gentle. I'll be the first to admit that I'm much happier in ObjC than C… I thought I would try static analysis and see what turned up. On the whole I must say I'm pleased but this one has me questioning my basic understanding if (![[NSFileManager defaultManager] fileExistsAtPath:thisPath]) { … 41 } else { 42 MDItemRef mdi = MDItemCreate( nil, (CFStringRef)thisPath ); 43 if ( mdi != nil ) { 44 CFDictionaryRef dictRef = MDItemCopyAttributes( mdi, MDItemCopyAttributeNames(mdi)); … CFRelease(dictRef); } else { … handle error } } Static Analysis tells me I have a potential leak of object allocated on line 44 -- that's all. My questions are: 1) Why is there not a warning for the object allocated on line 42 - mdi ? 2) Why is the CFRelease(dictRef) not sufficient? Thank you for you patience! Steve___ 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: Static Analyzer and Core Foundation
Luke; OK thank-you for that answer to question 2! Any thoughts on question 1? Steve On Sep 18, 2009, at 6:36 PM, Luke the Hiesterman wrote: Line 44 creates 2 objects, one goes into the dictRef, the other is not assigned to a variable, but is used only as the second argument to MDItemCopyAttributes. The object that you create inside that call is never released. Luke On Sep 18, 2009, at 4:33 PM, Steve Cronin wrote: Folks; Alert - potential boneheaded-ness lies ahead - please be gentle. I'll be the first to admit that I'm much happier in ObjC than C… I thought I would try static analysis and see what turned up. On the whole I must say I'm pleased but this one has me questioning my basic understanding if (![[NSFileManager defaultManager] fileExistsAtPath:thisPath]) { … 41 } else { 42 MDItemRef mdi = MDItemCreate( nil, (CFStringRef)thisPath ); 43 if ( mdi != nil ) { 44 CFDictionaryRef dictRef = MDItemCopyAttributes( mdi, MDItemCopyAttributeNames(mdi)); … CFRelease(dictRef); } else { … handle error } } Static Analysis tells me I have a potential leak of object allocated on line 44 -- that's all. My questions are: 1) Why is there not a warning for the object allocated on line 42 - mdi ? 2) Why is the CFRelease(dictRef) not sufficient? Thank you for you patience! Steve___ 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/luketheh%40apple.com This email sent to luket...@apple.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: Static Analyzer and Core Foundation
Luke; I've adapted the code to accomodate your's and Chris' answer to question 2. Here's the entire method, which now shows not static analyzer issues but I still would like to understand why not. + (NSDictionary *)metadataForFilePath:(NSString *)thisPath { NSDictionary *md = [NSDictionary dictionary]; if (![[NSFileManager defaultManager] fileExistsAtPath:thisPath]) { NSLog(@"file does not existl"); } else { MDItemRef mdi = MDItemCreate( nil, (CFStringRef)thisPath ); if ( mdi != nil ) { CFArrayRef arrayRef = MDItemCopyAttributeNames(mdi); CFDictionaryRef dictRef = MDItemCopyAttributes( mdi, arrayRef); md = [NSDictionary dictionaryWithDictionary:(NSDictionary *)dictRef]; CFRelease(dictRef); CFRelease(arrayRef); } else { NSLog(@"mdi is nil"); } } return md; } Is this the 'best' this can be? Thanks for helping me learn, Steve On Sep 18, 2009, at 6:44 PM, Luke the Hiesterman wrote: There's not enough code here to give a good answer to question 1. ___ 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
MutableDictionary setValue:forKeyPath - strange behavior
Folks; I have recently converted to XC & IB 3.2 I've updated my project to be a 3.2 project using a baseSDK of 10.6 with deployment target of 10.4 I've run the static analyzer and have no analyzer issues as well as no compiler nor IB warnings I'm feeling good about this but now code that worked under Leopard is no longer working. I have an instance variable which is an NSMutableDictionary * myBaseSettings I run a method which steps thru the keys in a local NSDictionary (sessionSettings) to possibly set some values into myBaseSettings NSDictionary * sessionSettings = ...; NSArray *values, *keys = [sessionSettings allKeys]; int dictCount = [keys count]; if (dictCount>0) { values = [sessionSettings allValues]; NSString *thisKey, *thisValue; for (i=0 ; i(NOTE: I use setValue:forKePath because the sessionSetting keys can be dictionaries) I get an exceptions thrown whenever thisKey is a normal 'key' (ie "workPhone") but NOT when thisKey is a 'keyPath' (ie. "nameDict.firstName") '*** -[NSCFDictionary setObject:forKey:]: mutating method sent to immutable object' The key and value are both valid strings (verified using 'po' gdb) It seems like somehow the instance variable is not being treated as an NSMutableDictionary but why? Thanks for any thoughts on this - I'm baffled! Steve ___ 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: MutableDictionary setValue:forKeyPath - strange behavior
Kyle; Thanks for such a speedy response. (and on a Sunday afternoon too!) That code is a fairly complex set of interlocking methods. Why would the construction of this NSMutableDictionary have anything to do with this error? Steve On Sep 20, 2009, at 1:51 PM, Kyle Sluder wrote: On Sep 20, 2009, at 11:35 AM, Steve Cronin wrote: I have an instance variable which is an NSMutableDictionary * myBaseSettings You need to post the code that creates this dictionary. --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: MutableDictionary setValue:forKeyPath - strange behavior
Kyle; In order to answer your request, I've gone back through the code that generates myBaseSettings essentially it is: NSMutableDictionary *localDict = [NSMutableDictionary dictionaryWithCapacity:70]; [localDict setObject:[self generateInterestingValue1] forKey:@"interestingKey"]; … … [self setMyBaseSettings:localDict]; where setMyBaseSettings is an old-school KVC setter method - (void) ssetMyBaseSettings:(NSMutableDictionary *) newSettings { if (myBaseSettings!= newSettings) { [myBaseSettings release]; myBaseSettings = [newSettings retain]; } } Does this provide you the information you are looking for? Steve On Sep 20, 2009, at 1:51 PM, Kyle Sluder wrote: On Sep 20, 2009, at 11:35 AM, Steve Cronin wrote: I have an instance variable which is an NSMutableDictionary * myBaseSettings You need to post the code that creates this dictionary. --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: MutableDictionary setValue:forKeyPath - strange behavior
Folks; Thanks for all of the guidance! I have found the issue. It turns out that [localDict copy] is what was being sent to the setBaseSetting. In dealing with the static analyzer's warnings I must have made this change and then had failed to back it out… MY BAD Removed this and all is well again. A tip of the hat to Kyle for immediately sending me in the right direction. Karl - darn fine point about the random nature of 'allKeys' (this code has been working fine for months - but I will stop relying on this 'side-effect') Thank-you all Steve On Sep 20, 2009, at 5:01 PM, Kyle Sluder wrote: On Sun, Sep 20, 2009 at 12:42 PM, Steve Cronin wrote: essentially it is: "Essentially" isn't good enough; actual copy-paste is necessary to ensure you're doing it correctly. NSMutableDictionary *localDict = [NSMutableDictionary dictionaryWithCapacity:70]; This is good. - (void) ssetMyBaseSettings:(NSMutableDictionary *) newSettings { There's an extra "s" in here… does this mean you didn't actually copy/paste the setter from your code? Or maybe you're using a synthesized @property(copy) getter but a manually implemented setter, and because you have typo'd the setter method, the compiler is synthesizing one for you instead? --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
Data Model Versions and -fetchRequestTemplateForName
Folks; I have recently converted to XC & IB 3.2 I've updated my project to be a 3.2 project using a baseSDK of 10.6 with deployment target of 10.4 I have a Core Data model that I've been very happy with starting in 10.4 and continuing in 10.5.. In readying for the brave new world ahead I have added a 'version' to the data model. I see 2 xcdatamodel documents (app1 and app2) - they are the same at this point After bring the app up to the tools and project setting described above I've begun testing the release product on Tiger, Leopard , and Snow Leopard. The following method worked fine on all 3 OSes before these changes - (NSArray *) elementsByTemplate:(NSString *) templateName { NSError *error = nil; NSArray *results; //moc is an instance variable for the managedObectContext NSFetchRequest * fReq = [[[moc persistentStoreCoordinator] managedObjectModel] fetchRequestTemplateForName:templateName]; @try { results = [moc executeFetchRequest:fReq error:&error]; } @catch ( NSException *e ) { NSLog(@"(Template:%@) Caught %@: %@ \r %@", templateName, [e name], [e reason], [e userInfo]); } if ( error != nil) { NSLog(@"%@ - Caught %i: %@ info = %@", NSStringFromSelector(_cmd), [error code], [error domain], [error userInfo]); } return ( (results==nil) ? [NSArray array] : results); } This fails on Tiger BUT continues to work normally on Leopard & Snow Leopard. fReg is NULL on Tiger (used to work fine on Tiger) so the exception get caught with 'fetch request must have an entity) [Yeah - so I do see that I should test for a null fetchRequest but that's not the issue really!] Is the model versioning the problem? Can I 'undo' that? (I can't do a 'fetchRequestTemplatesByName' because that was introduced in 10.5) Is there something I can do or that I am overlooking? I have backed the base SDK down to 10.5 (I can easily because I just made that change to 10.6 and have no embedded 10.6 code as yet) It still fails for Tiger. I have also removed app2 from the xcdatamodeld bundle but this also does not change the result. I'm stumped on what to do to remedy this situation! Thoughts? Steve ___ 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
App Crashing on a second AppleScript call
Folks; I have an app that receives AppleScript calls App passes Clang with no warnings; using XC 3.2 w/ 10.6SDK The call is made successfully and performs beautifully -- the first time! Everything works just as intended. The second script call is processed by the app but crashes immediately after it finishes processing. Here's the stack: #0 0x9330692c in objc_msgSend #1 0x00628d30 in ?? #2 0x93ae75bd in _CFAutoreleasePoolPop #3 0x94562e62 in NSPopAutoreleasePool #4 0x94562d8a in -[NSAutoreleasePool drain] #5 0x945aa25e in _NSAppleEventManagerGenericHandler #6 0x943bbde6 in aeDispatchAppleEvent #7 0x943bbce5 in dispatchEventAndSendReply #8 0x943bbbf2 in aeProcessAppleEvent #9 0x920de381 in AEProcessAppleEvent #10 0x911caed2 in _DPSNextEvent #11 0x911ca50a in -[NSApplication nextEventMatchingMask:untilDate:inMode:dequeue:] #12 0x9118c69b in -[NSApplication run] #13 0x91184735 in NSApplicationMain Any thoughts on what I am doing wrong? or how to track down what is going on? Thanks for your time and consideration, Steve ___ 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
Static Analyzer Question
Folks; I have a Clang issue that is making me a little crazy. I have a modestly complex Core Data application with several thousand lines of code. I've run Clang and at this point I have only one issue: "…. Object with +0 retain counts returned to caller where a +1 (owning) retain count is expected" this is shown at the end of a particular method. The deal is that, over time, I have isolated this method and at this moment there are NO methods which call it. I cannot leave it like this - this isolation is a result of honing in on the Clang issue... A very common pattern for my application looks like this: + (NSString *) fooBar { NSString *result = @""; ….. if (x) { result = @"1"; ... } else { result = @"2"; } return result; } Yes this is a class method - I use this pattern for both class and instance methods. This is the only method that Clang has an issue with… Why does Clang believe that an 'owning retain count is expected' if the method is never called? Why is Clang picking on this one method which mirrors the mechanics of so many others? Any thoughts appreciated! Steve ___ 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: Static Analyzer Question
Gentlemen; YES Bingo! + newWidgetID I love how Cocoa can so drive you crazy and then when insight happens it's often nearly painful in its elegance and simplicity… Breathtaking sometimes…. Thank-you all, Steve On Sep 29, 2009, at 5:12 PM, Steve Cronin wrote: "…. Object with +0 retain counts returned to caller where a +1 (owning) retain count is expected" this is shown at the end of a particular method. I think this means the method has a name that by convention indicates that it returns a reference the caller must release — i.e. a prefix of "alloc" or "copy" or "mutableCopy" + (NSString *) fooBar { NSString *result = @""; ….. if (x) { result = @"1"; ... } else { result = @"2"; } return result; } What's the actual name (not 'fooBar')? Why does Clang believe that an 'owning retain count is expected' if the method is never called? Objective-C is a dynamic enough language that there is no way to tell at compile time whether a method is reachable or not. Even if that selector never appears in your code, it could be constructed at runtime, or your code could load a plugin bundle that calls that selector. —Jens ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Nib Loading Crash on Tiger only
Folks; I have converted to using SL; XC3.2; IB 3.2. I have an app with a deployment target of 10.4 There are no IB warnings; the dev target is IB 3.2 Things have been working reasonably well but now when I test on a Tiger I crash immediately Leopard and Snow Leopard are fine 2009-09-30 01:34:18.529 XYZ[8852] An uncaught exception was raised 2009-09-30 01:34:18.530 XYZ[8852] *** -[NSKeyedUnarchiver decodeObjectForKey:]: cannot decode object of class (NSCoreUIImageRep) 2009-09-30 01:34:18.530 XYZ[8852] *** Uncaught exception: *** -[NSKeyedUnarchiver decodeObjectForKey:]: cannot decode object of class (NSCoreUIImageRep) I'm using .xib files but I don't what I should even be looking for. What is this trying to tell me? Steve ___ 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: Nib Loading Crash on Tiger only
Kyle * Graham; The IB Info says: Deployment Target: 10.4 Development Target: IB 3.2 There are no error or warnings! What should I be looking at? Steve On Sep 30, 2009, at 1:56 AM, Kyle Sluder wrote: Check your IB compatibility settings. Looks like you've archived an image into your nib that doesn't exist on Tiger. --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: Nib Loading Crash on Tiger only -- SOLVED (well made gone...)
Folks; I opened the .xib file in a text editor -searched for 'NSCoreUIImageRep' I found one instance (thankfully) and by 'reading' the text was able to determine that it was a matrix of 2 radio buttons. I removed the offending matrix and re-instantiated a fresh one. I monitored the .xib text as I re-sized it but was unable to generate a 'NSCoreUIImageRep' again. Compiled - deployed to Tiger -> works fine…. I dunno, my gut tells me that there is some way thru resize and cell spacing that IB 3.2 will use a 'NSCoreUIImageRep' but I gotta move on… Never was any IB warnings or errors…. Maybe this will help someone else… Thanks Graham and Kyle for the assist, Steve On Sep 30, 2009, at 1:56 AM, Kyle Sluder wrote: Check your IB compatibility settings. Looks like you've archived an image into your nib that doesn't exist on Tiger. --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
rangeOfString & UTF8
Folks; (thePhrase) : Geschäftsführer (CEO): (tString): Geschäftsführer (CEO) Both curPos = [thePhrase rangeOfString: tString options:NSCaseInsensitiveSearch].location; AND NSLocale *tLocale = [[[NSLocale alloc] initWithLocaleIdentifier:@"de_DE"] autorelease]; curPos = [thePhrase rangeOfString: tString options:NSCaseInsensitiveSearch range:NSMakeRange(0, [thePhrase length]) locale:tLocale].location; yield curPos == NSNotFound Here's some printout from the console: Printing description of thePhrase: Gesch\u00e4ftsf\u00fchrer (CEO): Printing description of tString: Gesch\u00e4ftsf\u00fchrer (CEO) What am I not understanding here? Steve___ 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: rangeOfString & UTF8 - SOLVED
Clark; OK thanks for the whack on the head… I had managed to convince myself that there was something about the utf8 umlats and all that I wasn't understanding … No the problem was simply that there was a trailing space at the end of tString -> 'Geschäftsführer (CEO) ' Thanks for your time! Steve On Oct 4, 2009, at 4:17 PM, Clark Cox wrote: On Sun, Oct 4, 2009 at 1:48 PM, Steve Cronin wrote: Folks; (thePhrase) : Geschäftsführer (CEO): (tString): Geschäftsführer (CEO) Both curPos = [thePhrase rangeOfString: tString options:NSCaseInsensitiveSearch].location; AND NSLocale *tLocale = [[[NSLocale alloc] initWithLocaleIdentifier:@"de_DE"] autorelease]; curPos = [thePhrase rangeOfString: tString options:NSCaseInsensitiveSearch range:NSMakeRange(0, [thePhrase length]) locale:tLocale].location; yield curPos == NSNotFound Here's some printout from the console: Printing description of thePhrase: Gesch\u00e4ftsf\u00fchrer (CEO): Printing description of tString: Gesch\u00e4ftsf\u00fchrer (CEO) What am I not understanding here? Something else must be going on. I've just tried to replicate your situation, and had no problems: [c...@ccox-shiny:~]% cat test.m #import int main() { NSString*thePhrase = @"Geschäftsführer (CEO):"; NSString*tString= @"Geschäftsführer (CEO)"; NSRange range = [thePhrase rangeOfString: tString options: NSCaseInsensitiveSearch]; NSLog(@"thePhrase = \"%...@\"", thePhrase); NSLog(@"tString = \"%...@\"", tString); NSLog(@"range = %@", NSStringFromRange(range)); return 0; } [c...@ccox-shiny:~]% cc test.m -framework Foundation -fobjc-gc && ./ a.out 2009-10-04 14:17:04.981 a.out[7705:903] thePhrase = "Geschäftsführer (CEO):" 2009-10-04 14:17:04.983 a.out[7705:903] tString = "Geschäftsführer (CEO)" 2009-10-04 14:17:04.983 a.out[7705:903] range = {0, 21} -- Clark S. Cox III clarkc...@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
#include CommonStrings.txt - 'no such file' error
Folks; I have a dozen or so strings that I use over and over in various classes. So here's what I've done I have a CommonStrings.txt file added to the project. It looks like this: NSString *gLeftBracket =@"<"; NSString *gRightBracket =@">"; If I #include this file somewhere in the project then I can use 'extern' in the classes/methods where I need one of these strings. benefits: one place for definition type-ahead works - more efficient code construction costs: global-ness violates object-oriented principles committed global overhead for entire project that doesn't benefit every class however there are only ~20 of these there is no inherent 'read-only' support (which is what I would prefer) On the whole I'm inclined to accept the costs for the benefits! Is there a better way to achieve the goal in ObjC2? But here's my real question: It appears that I cannot put the one and only #include CommonStrings.txt just anywhere in the project. Some locations work fine others result in a 'CommonStrings.tx.' - no such file error. I'm just cutting and pasting the #include statement - so I'm not munging the statement. I cannot see any rhyme or reason on where it works and where it doesn't… Can someone clarify this for me? Kochan ObjC2 p209 clearly states, "…variable must be defined someplace among your source files…" Thanks for your time, Steve___ 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: #include CommonStrings.txt - 'no such file' error
Folks; To Alexander: On the suggestion of using .m and .h files: If I use a single #include somewhere as shown below then I can within any method use extern NSString *gLeftBracket this allows other programmers to see immediately that it is defined elsewhere and I need not burden the entire class with the overhead #import the entire set of these common strings. It seems your approach require that I expose a given class to the entirety of the strings declared in the .m file. I believe my solution allows a more fine grained usage of these strings…. Please enlighten me if I am incorrect! To Fritz: Thank-you for opening my eyes on this! I had gotten it in my head that 'const' could not be used with objects!! This is very useful to me! Any thoughts on why the location of the single #include is so finicky? Steve On Mar 14, 2010, at 6:45 AM, Alexander Spohr wrote: > .txt looks wrong. > Why not create .h and .m and import the .h? > Usually you #import, not #include in ObjC. > > .h > extern NSString *gLeftBracket; > > .m > NSString *gLeftBracket=@"<"; > > atze > > > Am 14.03.2010 um 06:47 schrieb Steve Cronin: > >> Folks; >> >> I have a dozen or so strings that I use over and over in various classes. >> So here's what I've done >> >> I have a CommonStrings.txt file added to the project. It looks like this: >> NSString *gLeftBracket =@"<"; >> NSString *gRightBracket =@">"; >> >> If I #include this file somewhere in the project then I can use 'extern' in >> the classes/methods where I need one of these strings. >> benefits: >> one place for definition >> type-ahead works - more efficient code construction >> costs: >> global-ness violates object-oriented principles >> committed global overhead for entire project that doesn't benefit every >> class >> however there are only ~20 of these >> there is no inherent 'read-only' support (which is what I would prefer) >> >> On the whole I'm inclined to accept the costs for the benefits! >> >> Is there a better way to achieve the goal in ObjC2? >> >> But here's my real question: >> It appears that I cannot put the one and only #include CommonStrings.txt >> just anywhere in the project. >> Some locations work fine others result in a 'CommonStrings.tx.' - no such >> file error. >> I'm just cutting and pasting the #include statement - so I'm not munging the >> statement. >> I cannot see any rhyme or reason on where it works and where it doesn't… >> Can someone clarify this for me? >> Kochan ObjC2 p209 clearly states, "…variable must be defined someplace among >> your source files…" >> >> Thanks for your time, >> Steve___ >> >> 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/atze%40freeport.de >> >> This email sent to a...@freeport.de > ___ 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
UIApplication terminate?
Folks; I have an iPhone application that is used for a very specific purpose. After perusing and modifying data the user is given the option to effectively [Cancel] or [Save] After they have made their decision the app's purpose has been served for this instance. What I would like to do is exit gracefully. Back in the day you could [NSApp terminate] and all notifications etc were broadcast and an orderly end was accomplished. I don't want to pester the user with another alert or a dead screen for which the only reasonable action is [Home]. I'd like to shut the application down - I believe this is what the user will desire. How do I accomplish this? exit(0) seems a bit rude for my tastes but…. BTW: Is this the sort of thing that can hang up an approval?? (first one to run that gauntlet in about a week..) Thanks for any thoughts! Steve___ 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
Using the #import directive
Folks; I'm puzzled by a configuration Here are my assumptions: #import //generally a framework reference - is relative to /System/Library #import "foo.h" //source file found in $(SRCROOT) #import "bar/foo.h" // source file found in a directory relative to $(SRCROOT) I have an import statement like the last example but I can't find any "bar" directory I'm unable to determine the particular instance of "foo.h" that is being used here… There are no compiler warnings nor errors. There are no HeaderSearchPaths defined. UserSearchPaths is turned Off and none are specified. What am I not understanding correctly to help me find the darn "bar/foo.h" file? What setting is allowing the compiler to not burp on the import? Thanks, Steve___ 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: Using the #import directive
On Apr 1, 2010, at 5:58 PM, Jens Alfke wrote: > > On Apr 1, 2010, at 3:51 PM, Steve Cronin wrote: > >> I have an import statement like the last example but I can't find any "bar" >> directory >> I'm unable to determine the particular instance of "foo.h" that is being >> used here… > > Select "bar/foo.h" and press Cmd-Shift-D (File > Open Quickly). That should > open the header. Then you can command-click the window title to see the path. > > —Jens Jens; Thanks for this and it did allow me to find the offending file. I now would like to specify a different remote source for a few headers. I have set 'Header Search Paths" to "$(SRCROOT)/../../dir1/dir2" (recursive checked) I can't seem to figure out how to refer to them in the #import statement… #import "dir2/foo.h" -- no such #import "/foo.h"-- no such file.. How do I do this? Thanks for helping out here! Steve___ 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
My first framework - but no 'Header'
Folks; I'm trying to build my first framework. I added a new target of type framework. There are 4 build steps: Copy Headers, Compile Bundle Resources, Compile Sources, and Link Binary With Library I've added all the .h files to the 'Copy Headers' and all the .m files to 'Compile Sources' Everything compiles fine but there is no 'Headers' directory created… I've compared build settings with another project which successfully creates a framework - don't see any differences. I've checked the 'Info' on all build steps - they are all just 'Comments' What have I overlooked? Steve ___ 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
Automator Actions and CFBundleExecutable key
Folks; I have an Automator action that is giving me a confusing result. If I include an 'Executable File' key in the info.plist - debug compile - with no executable this key is pointless - release compile - no warning If I remove the 'Executable File' key from the info.plist - debug compile - no warnings - release compile - bundle has executable but no CFBundleExecutable key Damned if I do and damned if I don't…. Should I just include the key and ignore the debug compile warnings? Is there a compiler flag that I should be more informed about? Thanks for any information! Steve___ 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: Automator Actions and CFBundleExecutable key
On Apr 10, 2010, at 3:08 PM, Fritz Anderson wrote: > You don't say what kind of Automator action you are building — script, > AppleScript, or Cocoa? Cocoa > And what do you mean by "compile warnings?" The compiler doesn't know or care > about the contents of Info.plist. The build system might. But as far as I can > tell by your message, the build system didn't complain at all — you only > state your opinion that the key is "pointless." my bad 'compiler warnings' PhaseScriptExecution "Run Script" "build/XYZ.build/Debug/New Foo From Files.build/Script-AA5E153E10B0AFCF0082C21B.sh" cd /Volumes/DaBook/Projects/myProject/XYZ/Code .. /bin/sh -c "\"/Volumes/DaBook/Projects/myProject/XYZ/Code/build/XYZ.build/Debug/New Foo From Files.build/Script-AA5E153E10B0AFCF0082C21B.sh\"" warning: CFBundleExecutable key is pointless with no executable. Run Script:/usr/bin/amlint "${BUILT_PRODUCTS_DIR}/${FULL_PRODUCT_NAME}" > > And why does your action have "no executable" on debug compiles (or with the > CFBundleExecutable key present), and "has executable" on release compiles (or > with the key absent)? The presence of the key has no effect on whether a > binary is built. The build configuration has no effect on whether a binary is > built (modulo some really perverse build settings). It has the key - I merely cited the outcomes based on two different setups that I had constructed trying to understand what is going on... I have the key and remain puzzled by the 'pointless' warning that is tossed off as show immediately above > Xcode 3.1.3 (you'd do well to tell us what version of Xcode and what SDK > you're using, and how you created your project): XC 3.2.1 SDK 10.6 > > I created a kill-me Cocoa action in Xcode, from the template. Info.plist ha a > CFBundleExecutable key, set to ${EXECUTABLE_NAME}. Again, this makes sense, > because the plug-in has a binary executable. > So what happens if you compile for debug? > > Would you please clarify your problem? Trying ___ 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: Automator Actions and CFBundleExecutable key
On Apr 10, 2010, at 3:51 PM, Fritz Anderson wrote: > Did you change the action type to Cocoa after starting with AppleScript or > shell script? No > Have you examined the contents of the action bundle in the problem case? > Clean the target first, then build. Control-click Products > yourBundle in > the Groups & Files list, and Show in Finder. Control-click on the icon and > Show Package Contents. The debug version does NOT contain the MacOS executable but the release compile DOES contain this... I've poured over the build settings and simply do not see the what is preventing the debug compilation from producing this…. There are no other warnings tossed out during either compilation Any thoughts? > Is the processed Info.plist as you expect? What would I be looking for? > (Examine it with a text editor or Open As > Source in Xcode; the graphical > plist editor can be deceiving.) OK but what am I supposed to be checking?___ 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
Why is compiler warning for +setKeys:triggerChangeNotificationsForDependentKey: ??
Folks; Subclassed NSObject now getting compiler warnings - don't understand why? @interface ABC : NSObject { } @end @implementation ABC + (void)initialize { ... keys = [NSArray ..]; [self setKeys:keys triggerChangeNotificationsForDependentKey:@"xyz"]; ... } @end I'm seeing compiler warnings -> : warning: 'ABC' may not respond to '+setKeys:triggerChangeNotificationsForDependentKey:' What have I overlooked? Steve ___ 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: Why is compiler warning for +setKeys:triggerChangeNotificationsForDependentKey: ??
Graham; Directly from the current Apple docs:Key-Value Observing Programming Guide No mention of deprecation… Registering Dependent Keys It’s common that the value of one property of a class is dependent on the value of another property of the same class. Key-value observing provides a lightweight method of declaring these dependencies through the use of the class method setKeys:triggerChangeNotificationsForDependentKey:. The setKeys:triggerChangeNotificationsForDependentKey: class method specifies an array of keys that will cause a change notification to be triggered for the dependent key. Consider the case of a method that returns a person’s full name by combining the first and last names. The fullNameproperty is dependent on both the firstName property and the lastName property. Anytime the value of firstName orlastName changes, an observer notification must be sent for the fullName property. The example in Listing 1 registers this dependency and implements the accessor method for the fullName, firstName and lastName properties. Listing 1 Registering a dependent key + (void)initialize { [self setKeys:[NSArray arrayWithObjects:@"firstName",@"lastName",nil] triggerChangeNotificationsForDependentKey:@"fullName"]; } On Apr 20, 2010, at 8:53 PM, Graham Cox wrote: > > On 21/04/2010, at 11:48 AM, Steve Cronin wrote: > >> I'm seeing compiler warnings -> : warning: 'ABC' may not respond to >> '+setKeys:triggerChangeNotificationsForDependentKey:' >> >> What have I overlooked? > > > As a method that has been deprecated for a long time, perhaps it's no longer > being included in the headers of your current SDK? > > --Graham > > ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
App won't launch in Debug but release product is fine
Folks; I need to pare back a project, remove some of the cruft. I copied the entire project directory and renamed the project and bundle identifier for now. I've removed various IB widgets as well as objC classes. I can now build without any issues in debug and release. If I double click the release build product it launches as expected. If I try and build and go on the debug build I see "Run" appear in the lower console log in XCode and then nothing. I've been over the build configurations (but I admit I weary). I have cleared XCode caches and done clean build - 10.6 - XC 3.2.2 Any thoughts on what would cause this? Thank you! Steve ___ 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: App won't launch in Debug but release product is fine
On May 11, 2010, at 4:53 AM, Jonathan del Strother wrote: > Long shot : has it hit a breakpoint? No > And if not, what happens if you pause the debugger and step through? Here's the stack after I launch, see "Run", then hit 'Pause' #0 0x9809d2fa in mach_msg_trap #1 0x9809da67 in mach_msg #2 0x9276100f in __CFRunLoopRun #3 0x927600f4 in CFRunLoopRunSpecific #4 0x9275ff21 in CFRunLoopRunInMode #5 0x90c080fc in RunCurrentEventLoopInMode #6 0x90c07eb1 in ReceiveNextEventCommon #7 0x90c07d36 in BlockUntilNextEventMatchingListInMode #8 0x9728c135 in _DPSNextEvent #9 0x9728b976 in -[NSApplication nextEventMatchingMask:untilDate:inMode:dequeue:] #10 0x9724dbef in -[NSApplication run] #11 0x97245c85 in NSApplicationMain #12 0x5dc0 in main at main.m:25 To Uli's question there is nothing in the run log nor in the Console.app I know its something painfully obvious but I'm to wrapped up to see it… Steve___ 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
NSWindowController for Prefs XIB Question (Core Data involved)
Folks; I have a feeling that this is an embarrassing one so try and go easy on me… XC 3.2.2 I have a main nib that opens a window and that works fine. I used to have an NSPanel in this nib to handle preferences. I've decided it's a good idea to split the nib into two different nibs: the main nib and a preferences nib. I've looked over the Sketch project and used it as a model. I've also read over the Document-Based App Overview FAQ I've added a window nib to the project and then subclassed a NSWindowController. I've made the xib's files owner this window controller At this point I can get a simple empty window to open just fine. However, I'm using CoreData and I want to pass the existing MOC to the pref window: I have added an array controller to the pref nib with its MOC set to files owner's MOC in IB. The controller manages an entity not a mutable dictionary. MOC is a synthesized property of the PrefController (the windowController mentioned above). if (!prefPanelController) { prefPanelController = [[PreferencesController alloc] initWithWindowNibName:@"testPref"]; [prefPanelController setManagedObjectContext:[self managedObjectContext]]; } [prefPanelController showWindow:sender]; No window opens and I get a console error: Cannot perform operation without a managed object context Could someone give me the gentle head slap I need here? Steve ___ 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: NSWindowController for Prefs XIB Question (Core Data involved)
Folks; This one is driving me mad! I'm trying to bust up an overly complicated xib into 2 xibs - the main xib and a preference xib I've started completely over trying to implement a pref xib -- no CoreData just bare bones…. I have created a brand new subclass of NSWindowController: Pref2Controller there is not a single line of code in this object nor any instance variables. I have created a brand new xib file: ptest XCode creates the xib with a FilesOwner, FirstResponder, Application, and Window (set to releaseOnClose and visibleAtLaunch) I have set the FilesOwner to be an instance of Pref2Controller (using IB) I have set the window outlet of the FilesOwner to point to the NSWindow object (using IB) These two are the only changes I've made to ptest.xib When I use this code in the appDelegate: - (IBAction) configure:(id)sender { if (!prefPanelController) { prefPanelController = [[Pref2Controller alloc] initWithWindowNibName:@"ptest"]; } [prefPanelController showWindow:sender]; } The new ptest.xib window will open once but never again if I close it. this is true regardless of whether I set the window to releaseOnClose or not this is also true regardless of whether I have hooked up the window outlet or not logging [pController window] shows (null) regardless of whether I have outlet assigned or not as well as regardless of whether prefPanelController already exists or has just been alloc'ed and init'ed.. What I am just not understanding here? Please? Steve On May 20, 2010, at 10:08 PM, Steve Cronin wrote: > Folks; > > I have a feeling that this is an embarrassing one so try and go easy on me… > XC 3.2.2 > > I have a main nib that opens a window and that works fine. > I used to have an NSPanel in this nib to handle preferences. > I've decided it's a good idea to split the nib into two different nibs: the > main nib and a preferences nib. > > I've looked over the Sketch project and used it as a model. > I've also read over the Document-Based App Overview FAQ > > I've added a window nib to the project and then subclassed a > NSWindowController. > I've made the xib's files owner this window controller > At this point I can get a simple empty window to open just fine. > > However, I'm using CoreData and I want to pass the existing MOC to the pref > window: > I have added an array controller to the pref nib with its MOC set to files > owner's MOC in IB. > The controller manages an entity not a mutable dictionary. > MOC is a synthesized property of the PrefController (the windowController > mentioned above). > > if (!prefPanelController) { > prefPanelController = [[PreferencesController alloc] > initWithWindowNibName:@"testPref"]; > [prefPanelController setManagedObjectContext:[self > managedObjectContext]]; > } > [prefPanelController showWindow:sender]; > > No window opens and I get a console error: Cannot perform operation without > a managed object context > > Could someone give me the gentle head slap I need here? > Steve ___ 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: NSWindowController for Prefs XIB Question (Core Data involved) - Solved
Folks; I have figured at least part of this out. My PrefsController had an instance variable that was of a class from the Core Data Model. Since the MOC was not available until after the initWithWindow, anything derived from NSManagedObject is not valid. Once I removed this instance variable the window now now opens. Hopefully this is helpful to someone else…. Steve >> On May 20, 2010, at 10:08 PM, Steve Cronin wrote: >> >>> Folks; >>> >>> I have a feeling that this is an embarrassing one so try and go easy on me… >>> XC 3.2.2 >>> >>> I have a main nib that opens a window and that works fine. >>> I used to have an NSPanel in this nib to handle preferences. >>> I've decided it's a good idea to split the nib into two different nibs: the >>> main nib and a preferences nib. >>> >>> I've looked over the Sketch project and used it as a model. >>> I've also read over the Document-Based App Overview FAQ >>> >>> I've added a window nib to the project and then subclassed a >>> NSWindowController. >>> I've made the xib's files owner this window controller >>> At this point I can get a simple empty window to open just fine. >>> >>> However, I'm using CoreData and I want to pass the existing MOC to the pref >>> window: >>> I have added an array controller to the pref nib with its MOC set to files >>> owner's MOC in IB. >>> The controller manages an entity not a mutable dictionary. >>> MOC is a synthesized property of the PrefController (the windowController >>> mentioned above). >>> >>> if (!prefPanelController) { >>> prefPanelController = [[PreferencesController alloc] >>> initWithWindowNibName:@"testPref"]; >>> [prefPanelController setManagedObjectContext:[self >>> managedObjectContext]]; >>> } >>> [prefPanelController showWindow:sender]; >>> >>> No window opens and I get a console error: Cannot perform operation >>> without a managed object context >>> >>> Could someone give me the gentle head slap I need here? >>> Steve >> >> >> ___ >> >> 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/billy%40deviltrain.co.uk >> >> This email sent to bi...@deviltrain.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
ABAddressBook -> Default Account?
Folks; In Snow Leopard an Address Book user now has a preference setting for setting the 'default account for new contacts' -save always stores to the local machine regardless Am I just missing something? Thanks, Steve ___ 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
the ABLocalizedPropertyOrLabel() function
Folks; I am trying to understand the ABAddressBook's ABLocalizedPropertyOrLabel() function. I can find descriptions of what it is supposed to do but no actual examples or guidance on how to use it or the necessary conditions for it to work. I have configured a Snow Leopard machine to use Danish language and selected the 'Denmark' Region on the 'International' system preference pane. I've logged out and back in. The Finder menus are all in Danish and when I open Address Book the various labels are all in Danish. However, when I run a simple Cocoa app : NSLog(@"%@",ABLocalizedPropertyOrLabel(kABPhoneHomeLabel)); ---> home What have I overlooked in using this function? Thanks, Steve ___ 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
Multiple copies of an application installed
Folks; I've found through field testing that some of my customers are keeping several copies of my application on their computer. At various points in the usage, it is possible to launch the application using AppleScript as well as by invocations of -launchAppWithBundleIdentifier: However, when there are stale versions of an application around these do not launch the appropriate application. NSWorkspace does not appear to handle the notion that there might be more than one.. The return of absolutePathForAppBundleWithIdentifier is a NSString! How do other folks handle this situation? Ideally I would like to offer a list of the applications and inform the user of the unexpected consequences of this "collection"… Any thoughts appreciated. Steve___ 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
'ditto' troubles
Folks; This is a Mac application. I have a helper app that I want to transport inside of a larger app (Mother) At the user's discretion I want to deploy the helper app The helper app CAN be called by AppleScript. In order to help with Mother's file size and inadvertent calling of Helper (when not yet deployed) I want to do is compress the app inside of the mother application. When the user asks for it I will decompress Helper and deploy into the local file system. I have all of this working including a build step that compresses the appropriate release version of Helper (/usr/bin/ditto -c -k --sequesterRsrc --keepParent) At the time the user requests I initiate an NSTask and deploy: NSTask *unzipTask=[[NSTask alloc] init]; [unzipTask setLaunchPath:@"/usr/bin/ditto"]; [unzipTask setArguments:[NSArray arrayWithObjects:@"-x",@"-k",sourcePath,targetPath,nil]]; The problem is that the deployed Helper file has the 'X' icon and displays the "application is damaged.." message. If I take the Helper.zip file from the 'contents' and manually double click it then the decompression works fine…. I'm so close and just I can't see what's stopping this deployment. Is there a ditto flag I need to set that I'm not seeing? Any thoughts appreciated! Steve___ 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: 'ditto' troubles
Fritz; Thanks for the tip. Things so obvious after clarity has improved. The brain can be its own worst enemy… Anyway the deployed result was simply an empty directory containing the valid application. Reworking the original build step to remove the --keepParent appears to have done the trick… Thanks Again Steve On Feb 23, 2010, at 2:43 PM, Fritz Anderson wrote: > On 23 Feb 2010, at 2:11 PM, Steve Cronin wrote: > >> I have all of this working including a build step that compresses the >> appropriate release version of Helper >> (/usr/bin/ditto -c -k --sequesterRsrc --keepParent) >> >> At the time the user requests I initiate an NSTask and deploy: >> NSTask *unzipTask=[[NSTask alloc] init]; >> [unzipTask setLaunchPath:@"/usr/bin/ditto"]; >> [unzipTask setArguments:[NSArray >> arrayWithObjects:@"-x",@"-k",sourcePath,targetPath,nil]]; >> >> The problem is that the deployed Helper file has the 'X' icon and displays >> the "application is damaged.." message. >> >> If I take the Helper.zip file from the 'contents' and manually double click >> it then the decompression works fine…. > > You don't say whether you made the intermediate test of running > > /usr/bin/ditto -x -k Helper.zip SomewhereElse.app > > There might be diagnostic output. > > Also, did try to determine in what sense the expanded application was > damaged? Did you audit the expanded Info.plist and MacOS/Helper files? > Permissions (especially x bit for MacOS/Helper)? `files MacOS/Helper`? > > — 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
Improving the User Experience when Installing a Snow Leopard Service
Folks; I'm a big fan of Snow Leopard's revised support for Services. In fact my application has a service that I would like most of my customers to use. What I have found from watching test subjects install my software is that many folks stumble on enabling the service. I understand that user needs to be in charge but ... What I'm looking for here is if anyone on this list has encountered these issues and has developed improved experiences for the user. My initialization process 1) creates the user 'Services' directory if required 2) installs the XYZ.service file into this 'Services' directory 3) calls NSUpdateDynamicServices() so the user's view is updated 4) calls NSWorkspace with an 'openFile' to get the Keyboard pane open @"/System/Library/PreferencePanes/Keyboard.prefPane" At this point all the user has to do is check the checkbox for the XYZ Service (it's a Text service) The issues that I've observed are: The prefpane does not initially necessarily open to the 'shortcuts' tabView The 'Services' item is not selected in the source list The 'Text' section is far down out of view and the order of the section is not alphabetic so the user is confused where to find this section. Is there a Cocoa way to remedy any of these that does not involve SystemEvents? mainly 'cause using 'System Events' cascades a whole new 'get the user to check the checkbox' activity….. All in all getting the user to simply check this checkbox makes for a really bumpy "out-of-box" experience for my new customers…. Any and all thoughts on this appreciated Steve___ 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
Improving the User Experience for First Use of Downloadable Software
Folks; My Mac-based Cocoa application is now available as a free trial download from the internet. The first time a user opens the software a warning is shown informing the user that this software has never been used and was downloaded from the internet -- thanks redmond =[:-( I understand the necessity of this but the warning triggers a context change to the Finder which buries the newly opened software under an array of open Finder windows. I've now seen many users think that the new software doesn't start and become discouraged and dismissive of the software. Are there any tools or best practices which have been developed to deal with this immediate "push into the background" effect? Thanks for any thoughts! Steve ___ 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: Improving the User Experience for First Use of Downloadable Software
Folks; Thanks for the thoughts on this matter! I think Matt raises an great point about hijacking on subsequent launches. Personally I'm mistrustful of installers.. why does a simple application need to go mucking around on my system? why is this application different than all the other 'drag-n-drop' applications? I think it creates another barrier to installation - another excuse for the customer to bail... And it is yet more code to maintain -- for what benefit? Anyway wouldn't an installer have to pass the 'Quarantine' dialog also? Steve On Feb 26, 2010, at 3:19 PM, Matthew Lindfield Seager wrote: > On Friday, February 26, 2010, Charles Srstka wrote: >> I suppose for the time being, you could use -[NSApplication >> activateIgnoringOtherApps:] in your application delegate’s >> applicationDidFinishLaunching: method as a workaround. > > > Caveat Emptor: > If you do this you may annoy customers (on subsequent launches) who > launch your application and then switch to Safari/Mail/Finder/other > while your app is launching... Moments later (or seconds or minutes > later depending on how long your app takes to launch on that machine) > your app will appear to hijack the user's computer for no discernible > reason. > > > An additional step to avoid annoying these people might be to only > order your app to the front if it's the first time it has been > launched...? ($0.02) > > Matt ___ 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: Improving the User Experience for First Use of Downloadable Software
Nick; Sorry I created the wrong impression there. Of course I understand that there are 'things to be done' but Joe Consumer doesn't necessarily know this... Furthermore the installer don't make it clear what these things are nor why they should have to be installed now (while the customer is still just trying to figure out if they even want to use the software) If they want the bells and whistles then the application should provide a way to add these later… Installers are 'intimidating' and another reason to abandon the fragile 'investigation' impulse a the potential customer… I'm on a tear to reduce these reasons for abandoning…. My research shows if folks actually install and try my program - they tend to buy it! Steve On Feb 26, 2010, at 3:59 PM, Nick Zitzmann wrote: > > On Feb 26, 2010, at 2:38 PM, Steve Cronin wrote: > >> why does a simple application need to go mucking around on my system? > > Because there are some things, such as WebKit plugins, Dashboard widgets, > etc. that cannot be used without installing them somewhere outside of the > application bundle. > > Nick Zitzmann > <http://www.chronosnet.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
NSTableViewDropAbove visual remnant
Folks; I have a tableView which is working pretty handily. I support a form of import by dropping a text file on it. The backing arrayController returns an NSTableViewDropAbove for UI feedback purposes. (the row the file is dropped on (or above) doesn't actually matter) I chose NSTableViewDropAbove because DropOn might cause some to feel that a replacement would occur…. When I have complete the import process I call rearrangeObjects and all is well there is a bound filter predicate in the windowController EXCEPT the targetting indicator in the tableView remains visible… How do I clear this? Thanks for your consideration, Steve___ 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
The Location of the Service Menu
Folks; I want to provide a service which will open a small HUD for fine-tuning the request. It seems to me that this HUD should open nearby where the context request occurred. I've poked around some and haven't hit anything promising. As the recipient of the service call 'xyz: userData:error:' how would I best determine where the mouse is/was pointing at the time the context menu fired? Thanks for any thoughts or pointers! Steve ___ 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
Dragging text between NSTextFields - A 'source' question
Folks; I want to allow users to drag selected text between text fields. I have subclasses NSTextField and implemented: - (void)awakeFromNib { [self registerForDraggedTypes:[NSArray arrayWithObject:NSStringPboardType]];} - (unsigned int)draggingEntered:(id )sender { ... - (BOOL)performDragOperation:(id )sender { ... So I have the dragging part working just fine. But what I really want is - NSDragOperationMove The documents state that I should implement the NSDraggingSourceProtocol method: - (void)draggedImage:(NSImage *)anImage endedAt:(NSPoint)aPoint operation:(NSDragOperation)operation the discussion states: This method is invoked after the dragged image (anImage) has been released and the dragging destination has been given a chance to operate on the data it represents. This method provides the source object with an opportunity to respond to either a successful or a failed dragging session. For example, if you are moving data from one location to another, you could use this method to make the source data disappear from its previous location, if the dragging session is successful, or reset itself to its previous state, in the event of a failure. I have implemented this method in the subclass but it is never called! What am I overlooking? I did try adding to the .h @inteface declaration but it didn't change anything. Thanks for any help, Steve ___ 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
CoreData and ArrayControllers
Folks; Using 10.5 SDK deploying to 10.4 on an Intel 10.5.7 machine running XC 3.1.2 I have a Core Data model against which I have successfully loaded data. Now I want to display some data in a tableView - so I drag a stock arrayController from IB onto a window. I set the Mode to 'Entity' and state the Entity name and check 'Prepares Content' (not 'Laxy' - not supported on 10.4) No FetchPredicate - I'm just trying to build up incrementally... I bind the controller's ManagedObjectContext to the windowController's exposed manageObjectContext Hook up a tableView with one column to display some data from the controller, Compile - no errors Crashes immediately after the windowControllers -awakeFromNib with this stack: #0 0x92aa1e17 in objc_exception_throw #1 0x92fd6e8b in +[NSException raise:format:arguments:] #2 0x92fd6eca in +[NSException raise:format:] #3 0x937b4019 in -[_NSManagedProxy _managedObjectContext] #4 0x937b404a in -[_NSManagedProxy _persistentStoreCoordinator] #5 0x937b40d8 in -[_NSManagedProxy _entity] #6 0x937b421e in -[_NSManagedProxy usableSortDescriptorsFromArray:] #7 0x936568d2 in -[NSArrayController(NSManagedController) defaultFetchRequest] #8 0x937b3a98 in -[NSObjectController(NSManagedController) _executeFetch:didCommitSuccessfully:actionSender:] #9 0x938e3032 in _NSSendCommitEditingSelector #10 0x936c9d78 in -[NSController _controllerEditor:didCommit:contextInfo:] Core Data is up and running by the end of the windowController's - awakeFromNib. If I remove the controller - everything is fine. If I simply uncheck 'Prepares Content' the application will launch but there is no data shown in the tableView. What am I not seeing here? Steve ___ 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
Approaches for this Matching Problem?
Folks; I would like to solicit feedback on the best approach to solve this problem: "phrase contains any word in set {a,b,c...}" I have a user supplied phrase (usually 3-5 words; max of 10 words) -> thePhrase The user may provide any random phrase... I also have a user managed array of words (somewhere around 250 words) -> theTags Currently these are stored as records in a Core Data entity. This set of tags is fairly stable but is nonetheless managed by the user I want the fastest means of determining if thePhrase contains ANY member of theTags. Position and frequency are not important. If ANY Tag is found the 'evaluation' can stop immediately. method signature proposal - (BOOL) containsAnyTag:(NSString *) thePhrase; [NOTE: I may run this evalution several times in succession on different phrases so, for now, the set of Tags is already setup as an instance variable] I am open to considering all options. Speed is THE top priority. Code complexity is a far distant second. Seems like a job for regex but I'm a total newbie there and since I don't care about actual location nor frequency maybe it is NOT a job for regex.. Seems like there could be many ways to proceed but I hoping somebody might share some experience or insight. Thank-You, Steve ___ 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: Approaches for this Matching Problem?
Ken & Jerry; Thanks for the quick response! So I've been pondering and testing... 1) Why would I have to bust up/loop on thePhrase? This makes me face Jerry's issue of a universal solution for breaking on words. Just on general principal what would that solution be? [thePhrase componentsSeparatedByString:@" "] sure is easy, fast and effective for most of the folks who are going to pay for indie software But what is the right solution?? Seems like a common enough problem that there should be a well- defined, easily obtained, well-documented answer BUT in my case I don't care where, what word or how often - I just want to know IF a tag occurs in thePhrase!! thePhrase = 8 words theTags = 150 words the code below: 0.001 sec on 2Ghz MacBook -- Yeeoowssah! -- added benefits beyond spec -easy code to understand - not prone to error -Search and Comparison options allow for easily implemented flexibility - case-sensitivity; anchored, etc.. - (BOOL) containsTag:(NSString *)thePhrase { BOOL tagFound = NO; NSString *tag; NSEnumerator *tagEnum = [tags objectEnumerator]; //tags is an NSSet instance variable built from Core Data while ((tag=[tagEnum nextObject])!=nil) { if ([thePhrase rangeOfString:tag options:NSCaseInsensitiveSearch].location!=NSNotFound) { tagFound = YES; break; } } return tagFound; } Thanks for making life good! Steve ___ 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: Approaches for this Matching Problem?
Ken; Thanks as always for a thought-provoking and thorough response! 1) I haven't given up on those Tiger users yet... 2) I don't see how looping on the 'words' in thePhrase would change the 'ham' issue you raise - it would still match either on the word or the phrase. Am I missing something? 3) The actual tags in this particular context are extensive enough that this 'ham-confusion' is pretty unlikely and could be easily remedied by the user's management of the tag list... [e.g. service, management, institute] -- I know there remains the root forms issue but let's not drag that issue in here Steve On Jun 22, 2009, at 12:52 PM, Ken Thomases wrote: On Jun 22, 2009, at 3:10 AM, Steve Cronin wrote: So I've been pondering and testing... 1) Why would I have to bust up/loop on thePhrase? BUT in my case I don't care where, what word or how often - I just want to know IF a tag occurs in thePhrase!! Then you shouldn't refer to "words". If you just care if any of a set of strings appear in a given string, that's a different question. If one of your tags is "ham", do you want it to match a phrase containing "shame"? - (BOOL) containsTag:(NSString *)thePhrase { BOOL tagFound = NO; NSString *tag; NSEnumerator *tagEnum = [tags objectEnumerator]; //tags is an NSSet instance variable built from Core Data while ((tag=[tagEnum nextObject])!=nil) { if ([thePhrase rangeOfString:tag options:NSCaseInsensitiveSearch].location!=NSNotFound) { tagFound = YES; break; } } return tagFound; } If you can target Leopard or later, you can simplify this even more by using "for (NSString* tag in tags) ...". It's more efficient, too. Regards, Ken ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Sorting on a table view of a managed object - debugger throws exception
Folks; 10.5.7 - 10.5 SDK - target 10.4 I have a managed core data entity working pretty nicely. I can display values in a tableView blah-blah Clicking on table column headers does as expected IN RELEASE versions for both Tiger and Leopard. However, in the debugger a click on table column header causes an objc- exception. If I step thru eventually I can survive and proceed Error setting value for key path value of object 0x852600> (from bound object [entity: MyEntity, number of selected objects: 1](null)): [< MyAppDelegate 0x852600> setValue:forUndefinedKey:]: this class is not key value coding-compliant for the key code. I know, I know stop hitting yourself on the head with a hammer It just bugs me - why? Have I done something wrong somewhere? Is this a known bug? Steve ___ 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: Sorting on a table view of a managed object - debugger throws exception
Quincy; Hey thanks for some useful data! BUT it is not what is happening in this case. I have a base class MyManagedObject that all entities are derived from. MyManagedObject has the - setNilValueForKey: method defined. I set a breakpoint there and a log message as well. Neither are ever called. I have an array controller whose sort descriptors are bound in IB. This appears to work because the initial display of the table is ordered accordingly. There is no sort key nor selector specified in IB for the table column. The table column value is bound in IB to the array controller. Below is the full trace when I click on the table column header... Thanks for your time! Steve #0 0x93b63e17 in objc_exception_throw #1 0x9577bbd1 in -[NSException raise] #2 0x91b0abb0 in _NSSetValueAndNotifyForUndefinedKey #3 0x919f98c7 in _NSSetUsingKeyValueSetter #4 0x919f935e in -[NSObject(NSKeyValueCoding) setValue:forKey:] #5 0x91a7df81 in -[NSObject(NSKeyValueCoding) setValue:forKeyPath:] #6 0x9453332d in -[NSBinder _setValue:forKeyPath:ofObject:mode:validateImmediately:raisesForNotApplicableKeys:error :] #7 0x945330de in -[NSBinder setValue:forBinding:error:] #8 0x9455c8e6 in -[NSControllerConfigurationBinder controller:didChangeToSortDescriptors:] #9 0x9455c7ff in -[_NSBindingAdaptor controller:didChangeToSortDescriptors:] #10 0x94543aa5 in -[NSArrayController setSortDescriptors:] #11 0x919f935e in -[NSObject(NSKeyValueCoding) setValue:forKey:] #12 0x91a7df81 in -[NSObject(NSKeyValueCoding) setValue:forKeyPath:] #13 0x9453332d in -[NSBinder _setValue:forKeyPath:ofObject:mode:validateImmediately:raisesForNotApplicableKeys:error :] #14 0x945330de in -[NSBinder setValue:forBinding:error:] #15 0x94544670 in -[NSTableBinder tableView:didChangeToSortDescriptors:] #16 0x945445c8 in -[_NSBindingAdaptor tableView:didChangeToSortDescriptors:] #17 0x944a0804 in -[NSTableView setSortDescriptors:] #18 0x9481a561 in -[NSTableView _changeSortDescriptorsForClickOnColumn:] #19 0x9455332a in -[NSTableHeaderView _trackAndModifySelectionWithEvent:onColumn:stopOnReorderGesture:] #20 0x94552b47 in -[NSTableHeaderView mouseDown:] #21 0x94365133 in -[NSWindow sendEvent:] #22 0x94331cd9 in -[NSApplication sendEvent:] #23 0x9428f62f in -[NSApplication run] #24 0x9425c834 in NSApplicationMain ___ 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: Sorting on a table view of a managed object - debugger throws exception
Quincey; Do you in fact have a "code" property? On the app delegate? What's does it's @property (or accessor prototype) look like? The 'code' property is declared on an entity: MyEntity. The accessors were created by XCode itself using the 'Copy Method Declaration/Implementation to Clipboard' - (NSString *)code { NSString * tmpValue; [self willAccessValueForKey: @"code"]; tmpValue = [self primitiveValueForKey: @"code"]; [self didAccessValueForKey: @"code"]; return tmpValue; } - (void)setCode:(NSString *)value { [self willChangeValueForKey: @"code"]; [self setPrimitiveValue: value forKey: @"code"]; [self didChangeValueForKey: @"code"]; } The accessors work because the table is sorted when first presented. Sorted according to the sortDescriptor which is declared in MyAppDelegate and bound using IB to MyArrayController. SortDescriptor is, of course, an NSArray - which is also named 'code'. Furthermore this all works peachy in a Release build on either Tiger or Leopard. Clicking on tableColumn headers sort just as expected. But not in Debug build - In Debug if I click on table column header I get thrown into an error: Error setting value for key path value of object 0x852600> (from bound object 0x3cbe30>[entity:MyEntity, number of selected objects: 1](null)): [< MyAppDelegate 0x852600> setValue:forUndefinedKey:]: Steve ___ 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
Sorting an editable tableView of managed object
Folks; I have a simple one column tableView of a managed object. The text field in the table view is editable. I want to keep the table sorted when the user manually changes a value, I have registered for the notification: [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(myRefreshManagedObjects:) name:NSManagedObjectContextObjectsDidChangeNotification object:[self managedObjectContext]]; This notification is called at appropriate times. I iterate over the updated set NSUpdatedObjectsKey checking for the entity. If I find a match I determine what tableView is to be updated and call a method which does the following; - (void) sortManagedTable:(NSTableView *)tableView; { //array controllers use 'prepare content' and a fetch predicate //there is NO binding to a sortDesctiptor - the tableView handles the header clicks correctly without one NSSortDescriptor *titleDescriptor = [[tableView tableColumnWithIdentifier:@"titleValue"] sortDescriptorPrototype]; NSMutableArray *newSortDescriptors = [NSMutableArray arrayWithArray: [tableView sortDescriptors]]; [newSortDescriptors removeObject:titleDescriptor]; [newSortDescriptors insertObject:titleDescriptor atIndex:0]; [tableView setSortDescriptors:newSortDescriptors]; [tableView scrollRowToVisible:[[tableView selectedRowIndexes] firstIndex]]; [tableView setNeedsDisplay]; } But the tableView does not update to reflect the new ordering. What am I missing? Steve ___ 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: Sorting an editable tableView of managed object
Matt; Thanks that did the trick! I didn't add the binding because I only want to add bindings when I understand the value of doing so. In this case the table column headers all performed their various sorts as expected without the bindings - hence no bound sortDescriptors. Adding the binding does get the UI job done but leaves me at a dead end in my understanding of why the code I submitted doesn't accomplish my goal! Thanks for your time and help! Steve On Jul 4, 2009, at 5:51 PM, Matt Neuburg wrote: On Fri, 03 Jul 2009 17:00:59 -0500, Steve Cronin said: Folks; I have a simple one column tableView of a managed object. The text field in the table view is editable. I want to keep the table sorted when the user manually changes a value, //there is NO binding to a sortDesctiptor Why not? If there were, then you would just tell the array controller to rearrangeObjects - a one-liner. m. -- matt neuburg, phd = m...@tidbits.com, <http://www.tidbits.com/matt/> A fool + a tool + an autorelease pool = cool! AppleScript: the Definitive Guide - Second Edition! http://www.tidbits.com/matt/default.html#applescriptthings ___ 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
AppleScript Record and NSDictionary
Folks; From my Cooca app I want to call an AppleScript with several parameters one of which is an AppleScript record. I've got everything about calling and return values working smoothly. What I can't seem to get is how to create that parameter record. I have been able to build AppleScript lists using: NSAppleEventDescriptor *stringDesc, *thisList = [NSAppleEventDescriptor listDescriptor]; NSIndexSet *rowIndexes = [myTableView selectedIndexes]; unsigned int descIndex = 0, index; index = [rowIndexes firstIndex]; do { descIndex ++; stringDesc = [NSAppleEventDescriptor descriptorWithString:[[myArray objectAtIndex:index] valueForKey:@"someKey"]]; [thisList insertDescriptor:stringDesc atIndex:descIndex]; } while ((index = [rowIndexes indexGreaterThanIndex:index]) != NSNotFound); When I look at the docs for -recordDescriptor and I see the 4 character code business - I get the ugly sinking feeling but maybe that's the only way... I've tried to move the coercion into AppleScript but there is nothing that will do that except the magic 'user record fields'. But there are warnings about resouce use for the 'magic' values (And anyway while seated in front of this machine, I don;t really like magic!!) - (NSAppleEventDescriptor) coerceDictionary(NSDictioanary *)dictionary { NSAppleEventDescriptor *result = [NSAppleEventDescriptor recordDescriptor]; NSArray *keysArray = [dictionary allKeys]; NSArray *valuesArray = [dictionary allValues]; unsigned int keyCoount = [keysArray count]; for ( i = 0; i < keyCount; i++) { //the good stuff happens here } return result; } So is there an exprienced soul out there who might share a snippet of code or a an illuminating link? Steve ___ 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
IB TextField Bindings and dragging text
Folks; I have several text fields bound to a mutable dictionary in the window controller. Works fine. I want to provide drag-n-drop text snippets into these text fields. I have all the drag-n-drop working just fine -- (uses custom text fields and the window field editor) Within the performDragOperation there is a [self setString:newString]; This, unsurprisingly, does NOT update the bindings mechanism. Is there a way that I can 'flash' the bindings mechanism from within the custom text field or do I need to build out something in the delegate? Any other notions appreciated! Steve ___ 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 TextField Bindings and dragging text
Folks; Found the answer: NSDictionary *bindDict = [self infoForBinding:@"value"]; [[bindDict objectForKey:@"NSObservedObject"] setValue:newString forKeyPath:[bindDict objectForKey:@"NSObservedKeyPath"]]; On Aug 2, 2009, at 1:32 PM, Steve Cronin wrote: Folks; I have several text fields bound to a mutable dictionary in the window controller. Works fine. I want to provide drag-n-drop text snippets into these text fields. I have all the drag-n-drop working just fine -- (uses custom text fields and the window field editor) Within the performDragOperation there is a [self setString:newString]; This, unsurprisingly, does NOT update the bindings mechanism. Is there a way that I can 'flash' the bindings mechanism from within the custom text field or do I need to build out something in the delegate? Any other notions appreciated! Steve ___ 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
From NSTextView to address an NSTextField
Folks; NSTextView <- NSText <- NSView <- NSReponder <- NSObject NSTextField <- NSView <- NSReponder <- NSObject At runtime if I have access to an instance of NSTextView how can I address the NSTextField? I know I should know this but I having a 'moment'... Steve ___ 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
Intermittent Console Log Entries '.sdef error' - Where from? What does it mean?
Folks; I have a logging facility built into my application to assist in troubleshooting from the field. These 4 lines appear SOMETIMES in user submitted log files: 2009-08-12 10:57:55.383 MyApp[296:20b] .sdef error: (null) 2009-08-12 10:57:55.383 MyApp[296:20b] line number: 2 2009-08-12 10:57:55.430 MyApp[296:20b] .sdef error: (null) 2009-08-12 10:57:55.431 MyApp[296:20b] line number: 2 They occur during a method which processes an array response from an NSAppleScript: NSDictionary *errorDict = nil; NSAppleScript *appleScriptObject = [[[NSAppleScript alloc] initWithSource:theScript] autorelease]; NSAppleEventDescriptor *eventDescriptor = [appleScriptObject executeAndReturnError: &errorDict]; if (([eventDescriptor descriptorType]) && (errorDict==nil)) { return [appleScriptManager arrayFromAppleEventDescriptor:eventDescriptor]; } else { ... } I have never seen these lines appear during any testing on the test machines here nor during development. This method is executed by every customer who is submitting a log BUT these 4 lines only appear sometimes. There are no apparent repercussions to their appearance. The log files are fine either way. What causes this? Steve ___ 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 Predicate Builder - comparing dates
Folks; I have a Core Data entity that has a dateCreated and a dateModified - both NSDates in the object files. I'd like to construct a predicate that will retrieve all records where a record's dateModified is greater than that record's dateCreated. Its deceptively easy to setup something that looks like it should work using 'Control-click' and 'Key' in the predicate builder in XCode. But when I run queries it doesn't appear to yield the right results. My thinking is that the comparison operators don't properly evaluate dates (am I wrong?) So dropping back to code - how would I write this predicate in code? Thanks for any help! Steve ___ 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 Predicate Builder - comparing dates
Ben; Thanks for taking the time to respond. I believe that I was blinded by a build issue in my allegation that the Predicate Builder mechanism was not giving correct results. This seems to be working fine now. I'm glad you have expressed the fragility issue on equivalence - I'll remember that. Thanks for the predicate in code. It's amazing how often the Cocoa answers are simple and straightforward when you finally see them. I might suggest the predicate you cited be considered for inclusion in the Apple documentation somewhere. Most (all?) the examples use operators and some fixed value. I know it may seem obvious (it does seem obvious now) but, when you don't know, a range of different examples can be a godsend... Thank-you! Steve On Aug 29, 2009, at 7:35 PM, Ben Trumbull wrote: I have a Core Data entity that has a dateCreated and a dateModified - both NSDates in the object files. I'd like to construct a predicate that will retrieve all records where a record's dateModified is greater than that record's dateCreated. Its deceptively easy to setup something that looks like it should work using 'Control-click' and 'Key' in the predicate builder in XCode. But when I run queries it doesn't appear to yield the right results. My thinking is that the comparison operators don't properly evaluate dates (am I wrong?) Comparison operators work just fine on dates, although == and != are fragile since NSDates are double time stamps, and floating point numbers have odd == behavior. What does the predicate look like ? How is it not working ? What does SQL logging show ? So dropping back to code - how would I write this predicate in code? [NSPredicate predicateWithFormat:@"dateModified > dateCreated"] - 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
NSDateFormatter -dateFromString Question
Folks; NSDateFormatter *dateFormatter = [[NSDateFormatter alloc] init] ; [dateFormatter setFormatterBehavior:NSDateFormatterBehavior10_0]; [dateFormatter setDateFormat:@"%m/%d/%Y %H:%M:%S %z"]; ... NSDate *myDate = [dateFormatter dateFromString:@"06/27/2008 02:51:52 -0500"]; myDate = 06/27/20. What am I missing here? I expect the full date and time value to be reflected back in myDate... I use 10_0 because I'm just more familiar.. I've tried adding: [dateFormatter setDateStyle:NSDateFormatterLongStyle]; [dateFormatter setTimeStyle:NSDateFormatterFullStyle]; but that doesn't change anything... Thanks for any help, Steve 10.5.4 XC3.1 ___ 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 [EMAIL PROTECTED]
Returning exactly what has been promised
Folks; I find if I have a method which returns an NSString for example, that often, in the interior of that method I will use an NSMutableString to construct the string I intend to return. My question concerns the actual final return statement. Is there ANY reason to choose A over B? A) return [NSString stringWithString:myWorkingMutableString]; B) return myWorkingMutableString; It just kinda sticks in my craw me that I 'promised' an NSString and using (B) I don't return one. Yeah I do understand inheritance and that a mutable entity isKindOfClass of the base class I looking for reasons like edge cases, compiler optimization, error trapping, portability, etc.. Is there ANY benefit to the costs associated with the explicit declaration of (A)? Thanks for helping me better understand! Steve ___ 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 [EMAIL PROTECTED]
Is checking -count worth it?
Folks; I'm really trying to learn how to write smart fast code. Code that takes maximum advantage of all of the battle-tested intelligence built into Cocoa/ObjC2. Now days with the "halo" and the "JesusPhone", I personally smell an excellent book opportunity... But enough chit-chat. I have a mutable array, M. I want to remove an object, O, from M; O might not be in M. M which is being constantly diminished could become empty. Is this code worth it? if ([M count]>0) [M removeObject:O]; OR should I just do [M remove O]; I assume that I can't write better code than the removeObject's use of -indexOfObject to determine the existence/location of O. So there I get 'best performance' for free by just getting out of the way and letting Cocoa do its thing. Is the only way to really tell to test? Or is there a deeper insight that makes the choice clear? Steve ___ 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 [EMAIL PROTECTED]
Coding around a known bug
Folks: I'm looking for some advice on how to code around a Leopard bug (radar 5905139 & 5599887). Leopard broke the following: OSStatus returnCode = TransformProcessType(&psn, kProcessTransformToForegroundApplication); TransformProcessType used to bring a background app to the foreground, which it still does EXCEPT for the fact that the menubar does not get correctly established until the user first brings another app to the foreground and then re-establishes the 'wounded' app as the foreground. Once this 'app toggling' is done, all is well. So I can trap Tiger v. Leopard and do toggling only on Leopard, that's pretty straight-forward. What I'm looking for is best advice on how to get the menubar to be 'right' in code. I've tried: [[NSWorkspace sharedWorkspace] launchApplication:@"Finder"]; followed by an Applescript to 'activate' myself. OK it works, but it jarring to have the 'Finder' just suddenly jump into view and I'm quite sure customers will NOT like it. Any thoughts? Also any thoughts on how possibly to code this so that when, or if, Apple ever fixes TransformProcessType that the fix might right itself and not require a new version. Thanks, Steve ___ 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 [EMAIL PROTECTED]
Re: Coding around a known bug
Charles; Because I need to convert the app from a background (LSUIElement=1) application. I am not aware of an AppleScript way to do that. If there is one, can you share a pointer? Thanks for your time! Steve On Aug 2, 2008, at 1:40 PM, Charles Srstka wrote: On Aug 2, 2008, at 11:40 AM, Steve Cronin wrote: Folks: I'm looking for some advice on how to code around a Leopard bug (radar 5905139 & 5599887). Leopard broke the following: OSStatus returnCode = TransformProcessType(&psn, kProcessTransformToForegroundApplication); TransformProcessType used to bring a background app to the foreground, which it still does EXCEPT for the fact that the menubar does not get correctly established until the user first brings another app to the foreground and then re-establishes the 'wounded' app as the foreground. Once this 'app toggling' is done, all is well. So I can trap Tiger v. Leopard and do toggling only on Leopard, that's pretty straight-forward. What I'm looking for is best advice on how to get the menubar to be 'right' in code. I've tried: [[NSWorkspace sharedWorkspace] launchApplication:@"Finder"]; followed by an Applescript to 'activate' myself. OK it works, but it jarring to have the 'Finder' just suddenly jump into view and I'm quite sure customers will NOT like it. Any thoughts? Also any thoughts on how possibly to code this so that when, or if, Apple ever fixes TransformProcessType that the fix might right itself and not require a new version. Why not just use the AppleScript to bring your app to the foreground in the first place, instead of TransformProcessType? Charles ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to [EMAIL PROTECTED]
Launch Path Not Accessible
Folks; I'm trying to do something that seems like it should be easy, but I'm stymied by what I think is a permissions error I don't understand. I'm trying to run a script using NSTask. I have the static script stored as a separate file in my bundle. I have created a folder in my "Applications Support" directory called "Scripts" and copied my script and several items into this directory. Note that this has a space in the full pathname! SO I have tried the following: NSString *myScriptPath = [[self scriptsFolderPath] stringByAppendingPathComponent:@"myUseful.script"]; //yes I have verified this is a valid path!!! NSTask *task = [[[NSTask alloc] init] autorelease]; [task setLaunchPath: myScriptPath]; [task setArguments:[NSArray arrayWithObject:...]]; [task setStandardInput:[NSPipe pipe]]; [task launch]; ERRROR: launch path not accessible So, thinking that the 'space' maybe wanking out the 'setLaunchPath' I tried to convert to a 'safe' url path: NSURL *myScriptFileURL = [NSURL fileURLWithPath:t]; ... [task setLaunchPath:[myScriptFileURL absoluteString]]; Same error! The docs don't make it clear TO ME why I would need special permissions to launch a script in my own "App Support" directory. Am I out in the weeds chasing the wrong rabbits? Any guidance appreciated! Steve ___ 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 [EMAIL PROTECTED]
Re: Launch Path Not Accessible
Andrew: Thanks for the slap on the head! So I chmod'ed the file and no longer get the 'not accessible error' YEAH! BUT now I get: *** NSTask: Task create for path '/Users/steve/Library/Application Support/XYZ/Scripts/myUseful.o' failed: 88, "Malformed Mach-o file" So I must be missing something about the contents of script files. Here's my script: myUseful.m #import int main(int argc, char **argv) { char dummy; read(STDIN_FILENO, &dummy, 1); [NSAutoreleasePool new]; NSURL *url = [NSURL fileURLWithPath:[NSString stringWithUTF8String:argv[1]]]; LSOpenCFURLRef((CFURLRef)url, NULL); return 0; } You will just have to trust me that I DO need to launch the file in this manner. What do I need to do to this file to make it into the correct format? THANKS AGAIN for the chmod help! Steve On Aug 2, 2008, at 3:26 PM, Andrew Farmer wrote: On 02 Aug 08, at 13:01, Steve Cronin wrote: I'm trying to do something that seems like it should be easy, but I'm stymied by what I think is a permissions error I don't understand. I'm trying to run a script using NSTask. I have the static script stored as a separate file in my bundle. I have created a folder in my "Applications Support" directory called "Scripts" and copied my script and several items into this directory. Note that this has a space in the full pathname! SO I have tried the following: NSString *myScriptPath = [[self scriptsFolderPath] stringByAppendingPathComponent:@"myUseful.script"]; //yes I have verified this is a valid path!!! NSTask *task = [[[NSTask alloc] init] autorelease]; [task setLaunchPath: myScriptPath]; [task setArguments:[NSArray arrayWithObject:...]]; [task setStandardInput:[NSPipe pipe]]; [task launch]; ERRROR: launch path not accessible Are you sure myUseful.script is directly executable? Just because it's double-clickable in the Finder doesn't mean it's executable... if this is an AppleScript, though, you may have better luck working with NSAppleScript. So, thinking that the 'space' maybe wanking out the 'setLaunchPath' I tried to convert to a 'safe' url path: NSURL *myScriptFileURL = [NSURL fileURLWithPath:t]; ... [task setLaunchPath:[myScriptFileURL absoluteString]]; Nope. NSTask takes a filesystem path, not a URL. ___ 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 [EMAIL PROTECTED]
Re: Coding around a known bug - SOLVED (acceptably)
Andrew & Aaron Yes I have read the discussion in the docs related to TransformProcessType(). My bad - here's a more complete snippet: if (...some condition..) { ProcessSerialNumber psn = { 0, kCurrentProcess }; OSStatus returnCode = TransformProcessType(&psn, kProcessTransformToForegroundApplication); if( returnCode == 0) { SetFrontProcess(&psn); } } The result of this is that an icon does appear in the dock BUT the menubar is NOT shown until the application toggling business I described in the initial email occurs. I've also tried all Aaron's various suggestions related to NSMenu, and NSApplication all with the same result. Seems to me TransformProcessType(&psn, kProcessTransformToForegroundApplication) leaves the transformed process in a strange state; a state not expected by NSApplication. So here's what I've finally gotten to as an acceptable solution. This flashes the menubar but otherwise the context switch is as expected - no unexpected app jumps to front. (AppleScriptTool is a custom object which has various convenience methods I've developed) NSString *currentApp = [AppleScriptTool stringFromAppleScript:@"tell application \"System Events\" to name of first process whose frontmost is true"]; ProcessSerialNumber psn = { 0, kCurrentProcess }; OSStatus returnCode = TransformProcessType(&psn, kProcessTransformToForegroundApplication); if( returnCode == 0) { [[NSWorkspace sharedWorkspace] launchApplication:currentApp]; // this step is necessary - if left out the menubar is not updated [AppleScriptTool bringApplicationToFront:myAppName]; //uses @"tell application \"[EMAIL PROTECTED]" to activate" [NOTE: SetFrontProcess() doesn't work] } I cannot use NSWorkspace's -activeApplication in the first line because it sees the calling app as the active app... It also seems to me that when (if) Apple does fix TransformProcessType(), since the call to SetFrontProcess() is spelled out as necessary, that my solution will not break nor result in undesired behavior. Maybe someone else will find this useful... Thanks to all, Steve On Aug 2, 2008, at 6:11 PM, Andrew Merenbach wrote: On Aug 2, 2008, at 9:40 AM, Steve Cronin wrote: Folks: I'm looking for some advice on how to code around a Leopard bug (radar 5905139 & 5599887). Leopard broke the following: OSStatus returnCode = TransformProcessType(&psn, kProcessTransformToForegroundApplication); TransformProcessType used to bring a background app to the foreground, which it still does EXCEPT for the fact that the menubar does not get correctly established until the user first brings another app to the foreground and then re-establishes the 'wounded' app as the foreground. Once this 'app toggling' is done, all is well. So I can trap Tiger v. Leopard and do toggling only on Leopard, that's pretty straight-forward. What I'm looking for is best advice on how to get the menubar to be 'right' in code. I've tried: [[NSWorkspace sharedWorkspace] launchApplication:@"Finder"]; followed by an Applescript to 'activate' myself. OK it works, but it jarring to have the 'Finder' just suddenly jump into view and I'm quite sure customers will NOT like it. Any thoughts? Also any thoughts on how possibly to code this so that when, or if, Apple ever fixes TransformProcessType that the fix might right itself and not require a new version. Thanks, Steve Hi, Steve, The docs appear to mention something that may be of use -- see the Discussion for TransformProcessType(): You can use this call to transform a background-only application into a foreground application. A foreground application appears in the Dock (and in the Force Quit dialog) and contains a menu bar. This function does not cause the application to be brought to the front; you must call SetFrontProcess to do so. Apologies if you are already, but -- are you calling SetFrontProcess()? Cheers, Andrew ___ 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 [EMAIL PROTECTED]
Restarting an app -- AppleScript 'launch' in a detached shell
Folks; I am trying to simply restart my app. To my dismay, I cannot find a way to do this in Cocoa. Please enlighten me if I have failed to understand something!! After perusing the archives, what makes the most sense to me is to launch a detached shell that executes a simple AppleScript. The script has a delay of 2 seconds and then simply does a 'launch'. I've got the script working like a champ in a straight terminal session: > /usr/bin/osascript '/Users/steve/Desktop/Restart.script' So now: NSString *cmdString = [NSString stringWithFormat:@"/usr/bin/osascript '%@'",[[self scriptsFolderPath stringByAppendingPathComponent:@"Restart.script"]]; NSTask *task = [[[NSTask alloc] init] autorelease]; [task setLaunchPath:@"/bin/sh"]; [task setArguments:[NSArray arrayWithObjects:@"-c", cmdString, @" &", nil]]; //the '&' detaches the shell, yes? [task setStandardError:[NSFileHandle fileHandleForWritingAtPath:errorOutPath]]; [task waitUntilExit]; // <-- I've also tried [task launch] but the same result. [[NSApplication sharedApplication] terminate:self]; This unsurprisingly DOES quit the application but the script doesn't appear to execute, nothing further happens... Am I not using the argument list correctly? I also do not see anything at all in the file @ errorOutPath nor do I don't see any console messages. How could I pick up any data on what IS happening? I know I am missing something here but I AM puzzled... Thanks for any help! Steve ___ 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 [EMAIL PROTECTED]
Re: Restarting an app -- AppleScript 'launch' in a detached shell
Andrew; OK for the sake of the group I will parade my ignorance so that perhaps others can learn too... First I do understand your point that using AppleScript is using an unnecessary high-level tool when a lower-level tool will do! Thanks for keeping me on-point there!! Good old-school unix thinking - always a good thing. I have 4 questions 1) Given that it is higher-level than necessary, I would still appreciate understanding why it doesn't work. I revamped the '&' and added it to the end of the osaxscript command instead of passing as argument -> no change.. 2) In the script you cited, I don't understand the 'if(fork() || fork())' conditional test. Can you clarify this statement? 3) Why are you using 'execl' and not 'exec'? 4) When you say "...launch this with a single argument..." I' not sure of exactly what you mean. Launch how? I tried creating a text file with your script as the contents (Restart.unixscript) //enclose the paths in single quotes because there are potentially spaces in either path (eg 'Application Support') NSString *scriptPath = [NSString stringWithFormat:@"'%@'",[[self scriptsFolderPath] stringByAppendingPathComponent:@"Restart.unixscript"]]; NSString *myPath = [NSString stringWithFormat:@"'%@'",[[NSBundle mainBundle] bundlePath]]; NSFileHandle *stdErrors = [NSFileHandle fileHandleForWritingAtPath:@"/Users/steve/Desktop/RestartErrors.txt"]; NSTask *task = [[NSTask alloc] init]; [task setLaunchPath:@"/bin/sh"]; [task setArguments:[NSArray arrayWithObjects:scriptPath, myPath, nil]]; // no -c means that first parameter is file of commands [task setStandardError:stdErrors]; [task setStandardOutput:stdErrors]; [task launch]; [[NSApplication sharedApplication] terminate:self]; When I do this I get the following in stdErrors: /bin/sh: '/Users/steve/Library/Application Support/XYZ/Scripts/ Restart.unixscript': No such file or directory NOTE: enlosing in double quote doesn't change the result; nor obviously does not enclosing the paths in a delimiter at all Seems like I'm missing something Thank-you for your patience on this! Steve On Aug 3, 2008, at 4:12 PM, Andrew Farmer wrote: On 03 Aug 08, at 14:00, Steve Cronin wrote: I am trying to simply restart my app. To my dismay, I cannot find a way to do this in Cocoa. Please enlighten me if I have failed to understand something!! After perusing the archives, what makes the most sense to me is to launch a detached shell that executes a simple AppleScript. The script has a delay of 2 seconds and then simply does a 'launch'. You're overcomplicating things. int main(int argc, char **argv) { if(fork() || fork()) exit(0); sleep(2); execl(argv[1], argv[1], NULL); exit(1); } Launch this with a single argument - the path to your application's executable. It'll background itself, sleep two seconds, and exec your application. (Standard disclaimer: typed out in Mail, untested.) I've got the script working like a champ in a straight terminal session: > /usr/bin/osascript '/Users/steve/Desktop/Restart.script' So now: NSString *cmdString = [NSString stringWithFormat:@"/usr/bin/ osascript '%@'",[[self scriptsFolderPath stringByAppendingPathComponent:@"Restart.script"]]; NSTask *task = [[[NSTask alloc] init] autorelease]; [task setLaunchPath:@"/bin/sh"]; [task setArguments:[NSArray arrayWithObjects:@"-c", cmdString, @" &", nil]]; //the '&' detaches the shell, yes? & only detaches a command when it's part of a shell command. You're passing it as an argument to /bin/sh here, which is subtly different. ___ 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 [EMAIL PROTECTED]
CoreFoundation Command Line Tool - an easy beginner question
Folks; Here's the pretty simple tool I'm trying to create (THANK-YOU Michael Ash!!) int main (int argc, const char * argv[]) { char dummy; read(STDIN_FILENO, &dummy, 1); [NSAutoreleasePool new]; NSURL *url = [NSURL fileURLWithPath:[NSString stringWithUTF8String:argv[1]]]; LSOpenCFURLRef((CFURLRef)url, NULL); return 0; } I'm using XCode3.1 with the 10.5 SDK deploying to 10.4. I open new project using the CoreFoundation - Command Line Tool template, and place the code shown above. My question is what are the #imports necessary to make this work? I have figured out: #import //for the STDIN_FILENO and the read() #import //for the LSOpenCFURLRef I've tried various usages of #import but can't seem to get it right so that NSURL & NSAutoreleasePool are defined... I believe that both NSURL and NSAutoreleasePool are defined in the Foundation framework, which is why I am focused on getting it #imported, I just need the syntax.. (with Foundation framework added to the project) NO --> #include (~700 errors...) NO --> #include (45 errors..) Oh out of exasperation, I tried ---> ~1700 errors I know this is probably pretty easy for most, but its got me just bamboozled THANK-YOU for any help! Steve ___ 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 [EMAIL PROTECTED]
StatusItem to foreground app
Folks; I'm building a tool that I want to allow the user switch 'modes' either running as a menubar statusItem or as regular dock-based application. NOTE: The info.plist has LSUIElement=1. If the user designates the application to run as regular dock-based application then, early in startup, I do: ProcessSerialNumber psn = { 0, kCurrentProcess }; OSStatus returnCode = TransformProcessType(&psn, kProcessTransformToForegroundApplication); if( returnCode == 0) { ... I have this working fine under Leopard, however, the application's deployment target is 10.4. On the Tiger machines I'm getting a returnCode = -50. GetMacOSStatusErrorString tells me that there is an error in the user parameters. I have examined the psn high = 0 and low = 2 which seems right to me... The 10.4 application does NOT die; rather it continues to load and run EXCEPT there is no menu bar, no dock icon, and it is not listed in 'Force Quit'. (The TransformProcessType has failed.) Is the LSUIElement confusing 10.4? Was this a known bug on 10.4 that was never fixed? Was there a 10.4 workaround? So here's my predicament: I need the LSUIElement set to run as a statusItem (yes?) LSUIElement cannot be changed by code (yes?) If I have this set LSUIElement then I can ONLY run as a status item in 10.4. If I do not set LSUIElement then I can NEVER run as a status item in either Leopard or Tiger I really don't want to deploy separate binaries for obvious reasons. Does anyone have any insight into what is going on here? Thanks for any thoughts! Steve ___ 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 [EMAIL PROTECTED]
Built Menu not firing the action
Folks; I'm building a data driven submenu programmatically. The submenu appears correctly in the UI with the correct titles but nothing happens when these items are selected. submenu build code: menu1 = [[[NSMenu alloc] initWithTitle:@"__"] retain]; [menu1 setAutoenablesItems:NO]; NSEnumerator *titleEnum = [someArray objectEnumerator]; while ((nextTitle = [titleEnum nextObject])!=nil) { [menu1 addItemWithTitle:nextTitle action:@selector(customAction:) keyEquivalent:@""]; } ... [[mainMenu itemAtIndex:3] submenu] itemWithTag:1000] submenu] itemWithTag:1003] setSubmenu: menu1]; I spit menu1 out to NSLog and it looks fine. I set a breakpoint at customAction: it NEVER gets called. (Yes I have spelled it correctly [- (void) customAction:(id)sender;] This is on the mainMenu in the main XIB file. There is an outlet from appDelegate for mainMenu, this is set. The menu itself has the appDelegate set as its' delegate. The selector method is o method in the appDelegate object. There are no selector bindings set. (Note: there are enabled bindings set which are working correctly) I'm just stumped! I probably could use some sleep... Also how do you show some useful data from a SEL value in NSLog? ie print [NSMenuItem action]? Since nothing happens how do I debug this? Thank-you for any insights! Steve ___ 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 [EMAIL PROTECTED]
Re: Built Menu not firing the action
Peter; Thanks for the tip on NSStringFromSelector()! On the responder chain: I'm not sure I precisely understand your question - where are you expecting me to call this? If I call it at the time the submenu is being constructed I get: appDelegate Since I can't get any response to selecting the item itself, I can't tell you what I would get if I called it when the item is invoked =;-( If you use the NSMenu method -addItemWithTitle:(NSString *) action: (SEL) keyEquivalent:(NSString *) what is the recommended way to set the target for the menuItem added by this method? Why doesn't the method allow you to set the target as well as the selector, in one fell swoop? How can I effect the responder chain, if I am just adding a submenu to menuitem on the menubar? The REAL maddening thing here is that I have another similar data driven submenu that uses the same mechanism and it works fine. I've been over and over the IB settings for the darn things and I can't find any differences! Same point in time the submenu are being constructed and attached; and same exact objects involved in the selector Thanks for any additional data. Steve On Aug 25, 2008, at 1:20 PM, Peter Ammon wrote: On Aug 25, 2008, at 12:53 AM, Steve Cronin wrote: Folks; I'm building a data driven submenu programmatically. The submenu appears correctly in the UI with the correct titles but nothing happens when these items are selected. [...] I set a breakpoint at customAction: it NEVER gets called. (Yes I have spelled it correctly [- (void) customAction:(id)sender;] This is on the mainMenu in the main XIB file. There is an outlet from appDelegate for mainMenu, this is set. The menu itself has the appDelegate set as its' delegate. The selector method is o method in the appDelegate object. There are no selector bindings set. (Note: there are enabled bindings set which are working correctly) The most likely problem is that the object implementing the method is not in the responder chain. What object do you get if you call [NSApp targetForAction:@selector(customAction:)]? I'm just stumped! I probably could use some sleep... Also how do you show some useful data from a SEL value in NSLog? ie print [NSMenuItem action]? For debugging purposes, the easiest thing to do is to cast it to a char*, e.g.: gdb) p (char *)[someMenuItem action] For your actual code, you should use the NSStringFromSelector() function, as the char* nature of selectors is not guaranteed. -Peter ___ 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 [EMAIL PROTECTED]
Strange Strange Bug
Folks; OK this behavior has me a little spooked... This behavior occurs the first time through the method! I have a breakpoint set at the first line of a method, which happens to be a NSLog(@"Ready"); As is normal I have my local variable declarations at the beginning of the method: NSArray *myKeys, *workingValues; NSString *gAsOf, *gAsOfDate, *gDataMask, *gDataMaskName, *gID, *gIDName, *gVersion, *gVersionName; gAsOfDateName = [[NSUserDefaults standardUserDefaults] stringForKey:@"groupAsOfDatePropertyName"]; gDataMaskName = [[NSUserDefaults standardUserDefaults] stringForKey:@"groupDataMaskPropertyName"]; Nothing surprising or complicated... However, the console window will show at least two of these messages:. 2008-09-05 00:56:45.101 XYZ[345:813] *** -[CFString _cfTypeID]: message sent to deallocated instance 0x16d1db80 2008-09-05 00:56:45.563 XYZ[345:813] *** -[CFString _cfTypeID]: message sent to deallocated instance 0x16d1db80 2008-09-05 00:56:46.776 XYZ[345:813] *** -[CFString _cfTypeID]: message sent to deallocated instance 0x16d1db80 If I scroll the variables display at the upper right in the debugger window, the console will add more of these messages. One of the strings in the variable display will have its 'Value' shown as the instance id shown in these messages. For this string variable the 'Summary' will be empty as opposed to all other 'Summary' which have 'Invalid' The debugger is paused several lines above the declaration of this variable... If I merely switch the positions of the variables I can change which variable has the 'bad' instance id. It is always the 6th declared string variable. I can mix up the order of variables, change the actual variable names, or interleave NSArray declarations, it doesn't matter...the 6th string exhibits this behavior. Hovering over the variable it displays the 'yellow help ribbon' with 'NSZombie_CFString', whereas all the others are 'NSString' Commenting out the declarations and use and compiling works fine. Uncommenting brings back the exact behavior. Note: If I take out the breakpoint then the console does NOT show these messages even though I have left log messages in the method so I know the method is being executed I have restarted XCode as well as the system (Intel 10.5.4, XC3.1) no change What in the heck is going on? Should I be worried? How can I shed this anomaly? Thanks, Steve ___ 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 [EMAIL PROTECTED]
Re: Strange Strange Bug
Kai; OK That seems reasonable but: why do I not see this behavior anywhere else? why have I never seen it before now? why if I restart XCode does the 'bad' instance fall on exactly the same string? Thanks, Steve On Sep 5, 2008, at 4:11 AM, Kai wrote: Steve, looks like the debugger tries to inspect your uninitialized string pointers. And it happens that the stack location assigned to the 6th string pointer still contains the address of a now deallocated object left there when another method exited. So this is a debugger-only problem and completely harmless without debugger (if I am not mistaken, of course). To fix it, assign nil to the string pointers when you declare them: NSString *gAsOf = nil; etc.. Or, better yet, do not declare the variables before using them (that is, not all together at the start of the method). (Note that this style may be only possible with certain C dialects. I use Objective C ++, therefore I’m not sure). Hope this helps. Kai On 5.9.2008, at 09:04, Steve Cronin wrote: Folks; OK this behavior has me a little spooked... This behavior occurs the first time through the method! I have a breakpoint set at the first line of a method, which happens to be a NSLog(@"Ready"); As is normal I have my local variable declarations at the beginning of the method: NSArray *myKeys, *workingValues; NSString *gAsOf, *gAsOfDate, *gDataMask, *gDataMaskName, *gID, *gIDName, *gVersion, *gVersionName; gAsOfDateName = [[NSUserDefaults standardUserDefaults] stringForKey:@"groupAsOfDatePropertyName"]; gDataMaskName = [[NSUserDefaults standardUserDefaults] stringForKey:@"groupDataMaskPropertyName"]; Nothing surprising or complicated... However, the console window will show at least two of these messages:. 2008-09-05 00:56:45.101 XYZ[345:813] *** -[CFString _cfTypeID]: message sent to deallocated instance 0x16d1db80 2008-09-05 00:56:45.563 XYZ[345:813] *** -[CFString _cfTypeID]: message sent to deallocated instance 0x16d1db80 2008-09-05 00:56:46.776 XYZ[345:813] *** -[CFString _cfTypeID]: message sent to deallocated instance 0x16d1db80 If I scroll the variables display at the upper right in the debugger window, the console will add more of these messages. One of the strings in the variable display will have its 'Value' shown as the instance id shown in these messages. For this string variable the 'Summary' will be empty as opposed to all other 'Summary' which have 'Invalid' The debugger is paused several lines above the declaration of this variable... If I merely switch the positions of the variables I can change which variable has the 'bad' instance id. It is always the 6th declared string variable. I can mix up the order of variables, change the actual variable names, or interleave NSArray declarations, it doesn't matter...the 6th string exhibits this behavior. Hovering over the variable it displays the 'yellow help ribbon' with 'NSZombie_CFString', whereas all the others are 'NSString' Commenting out the declarations and use and compiling works fine. Uncommenting brings back the exact behavior. Note: If I take out the breakpoint then the console does NOT show these messages even though I have left log messages in the method so I know the method is being executed I have restarted XCode as well as the system (Intel 10.5.4, XC3.1) no change What in the heck is going on? Should I be worried? How can I shed this anomaly? Thanks, Steve ___ 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/kai%40granus.net This email sent to [EMAIL PROTECTED] ___ 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 [EMAIL PROTECTED]
Dragging tableView rows to an external applications
Folks; I'm trying in 10.4+ to implement dragging data from a tableView to the desktop. My problem is probably a dunderhead oversight but I can't see it. I have NOT subclassed an NSTableView. In a windowController I do the following in -awakeFromNib: (myTableView is an Outlet) ... [myTableView registerForDraggedTypes:[NSArray arrayWithObjects:NSFilenamesPboardType, NSFilesPromisePboardType, nil]]; [myTableView setDraggingSourceOperationMask:NSDragOperationNone forLocal:YES]; //local [myTableView setDraggingSourceOperationMask:NSDragOperationCopy forLocal:NO]; // external ... I get a local copy, drag some selected rows initiates a 'carrying' cursor, but as soon as I leave my application it invalidates. This is exactly the opposite of the desired/expected behavior... NOTE: If I change both drag operations in the setDraggingSourceOperation method to NSDragOperationEvery - no difference. myTableView has the windowController set as its delegate. The tableView:writeRowsWithIndexes:toPasteboard is being called (its in the windowController too) What am I overlooking? Steve ___ 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 [EMAIL PROTECTED]
Horizontal SplitView Resize Question
Folks; I have a horizontal split bar inside of a resizable view -the parent view grows both horizontally and vertically. The standard behavior for horizontal split views appears to be that the the bottom view is grown or shrunk. (In my testing this is true regardless of the resize attributes of the enclosed bottom view) I have ALL of the resize widgets set ON for this splitView. What I would like is the divider to stay fixed at its current height from the bottom throughout a resize and the top view to grow or shrink. Is there a setting I am overlooking or is the way to accomplish this by overriding -splitViewDidResizeSubviews? Thanks, Steve ___ 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 [EMAIL PROTECTED]
How to debug a nib loading error?
Folks; Tiger 10.4.11 -- XC 2.4.1 I'm baffled by an IB error. Reasonable development has been on-going. Pretty stringent Build Rules and no errors or warnings. I decide to do a clean build, torch the app's prefs file and the CoreData store. I want to focus on the initial installation phase of the app... To my great surprise I cannot now get the app to launch successfully. It ran fine 15 minutes beforehand... Regardless of whether I 'Run' or 'Debug' I get the exact same result: I get all the way through the appDelegate's -awakeFromNib and the pref window opens (as I expect on first launch) but the debugger kicks in with the following: #0 0x90a594c7 in objc_msgSend #1 0xb7b8 in ?? #2 0x932849d8 in loadNib #3 0x932843d9 in +[NSBundle(NSNibLoading) _loadNibFile:nameTable:withZone:ownerBundle:] #4 0x9328403a in +[NSBundle(NSNibLoading) loadNibFile:externalNameTable:withZone:] #5 0x93283f7c in +[NSBundle(NSNibLoading) loadNibNamed:owner:] #6 0x93283cc3 in NSApplicationMain #7 0x00405ffc in main at main.m:18 In the Console I see: Normal log messages that I generate and expect (including the 'end-of-awake-from-nib' stamp) Program received signal: "EXC_BAD_ACCESS". I have the [NSException raise] as a Global breakpoint but it doesn't fire. Using the po command I can tell that MainMenu is the nib involved; the prefs window is in a separate nib... How do I track this down? Steve ___ 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 [EMAIL PROTECTED]
Re: How to debug a nib loading error?
Jon; Thanks for the quick response!! If I set the NSZombieEnabled variable to YES I get the following: #0 0x9282b36d in -[NSException raise] #1 0x92852247 in +[NSException raise:format:] #2 0x928da79b in logMessageAndRaise #3 0x927dc8af in NSPopAutoreleasePool #4 0x932849d8 in loadNib #5 0x932843d9 in +[NSBundle(NSNibLoading) _loadNibFile:nameTable:withZone:ownerBundle:] #6 0x9328403a in +[NSBundle(NSNibLoading) loadNibFile:externalNameTable:withZone:] #7 0x93283f7c in +[NSBundle(NSNibLoading) loadNibNamed:owner:] #8 0x93283cc3 in NSApplicationMain #9 0x00405ffc in main at main.m:18 Console: 2008-03-07 01:33:24.728 XYZ[372] *** Selector 'release' sent to dealloced instance 0x1baba2c0 of class NSConcreteData. Break at '-[_NSZombie release]' to debug. NOTE: I do an 'API' & and a Full-Text Search in the documentation for 'NSConcreteData' and there is nothing! Not a single reference. Google yields more but NSConcreteData is definitely not used directly by my app. *** How do I determine what 'instance 0x1baba2c0 of class NSConcreteData' is? If I add a global breakpoint for -[NSZombie release] I get: #0 0x928da958 in -[_NSZombie release] #1 0x927dc8af in NSPopAutoreleasePool #2 0x932849d8 in loadNib #3 0x932843d9 in +[NSBundle(NSNibLoading) _loadNibFile:nameTable:withZone:ownerBundle:] #4 0x9328403a in +[NSBundle(NSNibLoading) loadNibFile:externalNameTable:withZone:] #5 0x93283f7c in +[NSBundle(NSNibLoading) loadNibNamed:owner:] #6 0x93283cc3 in NSApplicationMain #7 0x00405ffc in main at main.m:18 Nothing in the console. How does this help me? What is useful about this? Is there a gdb command I should invoke on frame 0? If I 'Enable Guard Malloc" the application takes over 15 minutes and finally appears to launch and but just seems to hang! Nothing in the debugger or console Thanks for your further consideration! Steve On Mar 7, 2008, at 12:44 AM, Jonathan Hess wrote: I would start by debugging with the NSZombieEnabled environment variable set to YES. You can read about that environment variable here: http://developer.apple.com/technotes/tn2004/tn2124.html If that doesn't work, I would try running with libgmalloc enabled. You can turn that on with "Enable Guard Malloc" in the Xcode "Run" menu. Good Luck - Jon Hess On Mar 6, 2008, at 10:36 PM, Steve Cronin wrote: Folks; Tiger 10.4.11 -- XC 2.4.1 I'm baffled by an IB error. Reasonable development has been on-going. Pretty stringent Build Rules and no errors or warnings. I decide to do a clean build, torch the app's prefs file and the CoreData store. I want to focus on the initial installation phase of the app... To my great surprise I cannot now get the app to launch successfully. It ran fine 15 minutes beforehand... Regardless of whether I 'Run' or 'Debug' I get the exact same result: I get all the way through the appDelegate's -awakeFromNib and the pref window opens (as I expect on first launch) but the debugger kicks in with the following: #0 0x90a594c7 in objc_msgSend #1 0xb7b8 in ?? #2 0x932849d8 in loadNib #3 0x932843d9 in +[NSBundle(NSNibLoading) _loadNibFile:nameTable:withZone:ownerBundle:] #4 0x9328403a in +[NSBundle(NSNibLoading) loadNibFile:externalNameTable:withZone:] #5 0x93283f7c in +[NSBundle(NSNibLoading) loadNibNamed:owner:] #6 0x93283cc3 in NSApplicationMain #7 0x00405ffc in main at main.m:18 In the Console I see: Normal log messages that I generate and expect (including the 'end-of-awake-from-nib' stamp) Program received signal: "EXC_BAD_ACCESS". I have the [NSException raise] as a Global breakpoint but it doesn't fire. Using the po command I can tell that MainMenu is the nib involved; the prefs window is in a separate nib... How do I track this down? Steve ___ 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/jhess%40apple.com This email sent to [EMAIL PROTECTED] ___ 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 [EMAIL PROTECTED]
XCode3 & NSLog & Tiger compatibility
Folks; I've finally begun to use XCode3 and I know I need to learn my way around the new world. I have an existing Tiger project that I will be shipping under Tiger but I need to ensure Leopard compatibility. So I can't convert it to the new world - I just need to be able to run/debug it. So immediately I run into the changes to Run log -> Console. OK - I try and understand what's going on but I can't seem to find anything useful which explains: If you have line of Tiger Code: NSLog(@"Hello World"); Where does this output appear in XCode3? I can see it sometimes in the Console.app but not reliably... (I have setup a database query for my 'Sender'.) I can see it sometimes in the Console log in XCode but not reliably.. I can't change the statements to ASL based statements per above.. How can I best use XCode3 to accomplish this mission? Thanks! Steve ___ 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 [EMAIL PROTECTED]
CoreData code working on Tiger - not on Leopard
Folks; I am now testing a Tiger application on Leopard and learning the new Leopard way at the same time. I admit I have a lot of Leoparding to do! I use Core Data (SQLite) pretty extensively on Tiger - life is good. I take the project and run it without any changes to the model or the code and Core Date won't save to disk. I load a set of data on initial launch and at the end of that process I have Core Data 'save'. The data loading all appears to run fine: recX = [NSEntityDescription insertNewObjectForEntityForName:@"XYZ" inManagedObjectContext:moc]; [recX setValue:@"123" forKey:@"source"]; ... 5 different entities and 1,000s of records.. I've looked over the 'Core Data - Release Notes' but I don't see anything that seems to indicate a model conversion or persistant store conversions I have not made any changes (no versioning...) Here's the 'save' code: - (void) updateCoreData { NSManagedObject *moc = [self managedObjectContext]; [moc processPendingChanges]; if ([moc commitEditing]) { NSError *error; if ([moc save:&error]) { if (error!=nil) { On Leopard in the 'processPendingChanges' invocation I get the following: 0 0x900ef0f4 in ___TERMINATING_DUE_TO_UNCAUGHT_EXCEPTION___ #1 0x93d680fb in objc_exception_throw #2 0x9649a2a5 in -[NSManagedObjectContext (_NSInternalChangeProcessing) _processRecentChanges:] #3 0x964adbea in -[NSManagedObjectContext processPendingChanges] #4 0x0002032e in -[AppDelegate updateCoreData] at AppDelegate.m:700 BTW: I also get a similar error if, during the loading, I try to get a 'count' using a FetchTemplate with a null predicate (works on Tiger) It appears the fetch also causes a 'processRecentChanges) What am I missing? Thanks for your help! Steve ___ 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 [EMAIL PROTECTED]
XCode3 errors on startup
Folks; When I start XCode3 in Leopard I am seeing the following in Console.app. Any ideas on what is going on? Steve 3/18/08 8:27:39 AM Xcode[110] Xcode(110,0xb0103000) malloc: free_garbage: garbage ptr = 0x2963030, has non-zero refcount = 1 3/18/08 8:27:39 AM Xcode[110] Xcode(110,0xb0103000) malloc: free_garbage: garbage ptr = 0x2963d90, has non-zero refcount = 1 3/18/08 8:27:39 AM [0x0-0xd00d].com.apple.Xcode[110] Xcode (110,0xb0103000) malloc: free_garbage: garbage ptr = 0x2963030, has non-zero refcount = 1 3/18/08 8:27:39 AM [0x0-0xd00d].com.apple.Xcode[110] Xcode (110,0xb0103000) malloc: free_garbage: garbage ptr = 0x2963d90, has non-zero refcount = 1 3/18/08 8:33:16 AM Xcode[110] Xcode(110,0xb0103000) malloc: free_garbage: garbage ptr = 0x31cfed0, has non-zero refcount = 1 3/18/08 8:33:16 AM Xcode[110] Xcode(110,0xb0103000) malloc: free_garbage: garbage ptr = 0x3725640, has non-zero refcount = 1 3/18/08 8:33:16 AM Xcode[110] Xcode(110,0xb0103000) malloc: free_garbage: garbage ptr = 0x30ed7e0, has non-zero refcount = 1 3/18/08 8:33:16 AM Xcode[110] Xcode(110,0xb0103000) malloc: free_garbage: garbage ptr = 0x31a9610, has non-zero refcount = 1 3/18/08 8:33:16 AM [0x0-0xd00d].com.apple.Xcode[110] Xcode (110,0xb0103000) malloc: free_garbage: garbage ptr = 0x31cfed0, has non-zero refcount = 1 3/18/08 8:33:16 AM [0x0-0xd00d].com.apple.Xcode[110] Xcode (110,0xb0103000) malloc: free_garbage: garbage ptr = 0x3725640, has non-zero refcount = 1 3/18/08 8:33:16 AM [0x0-0xd00d].com.apple.Xcode[110] Xcode (110,0xb0103000) malloc: free_garbage: garbage ptr = 0x30ed7e0, has non-zero refcount = 1 3/18/08 8:33:16 AM [0x0-0xd00d].com.apple.Xcode[110] Xcode (110,0xb0103000) malloc: free_garbage: garbage ptr = 0x31a9610, has non-zero refcount = 1 3/18/08 8:33:18 AM Xcode[110] Xcode(110,0xb0103000) malloc: free_garbage: garbage ptr = 0x318bda0, has non-zero refcount = 1 3/18/08 8:33:18 AM Xcode[110] Xcode(110,0xb0103000) malloc: free_garbage: garbage ptr = 0x3245320, has non-zero refcount = 1 3/18/08 8:33:26 AM Xcode[110] Xcode(110,0xb0103000) malloc: free_garbage: garbage ptr = 0x3047dc0, has non-zero refcount = 1 3/18/08 8:33:26 AM Xcode[110] Xcode(110,0xb0103000) malloc: free_garbage: garbage ptr = 0x308a7c0, has non-zero refcount = 1 3/18/08 8:33:18 AM [0x0-0xd00d].com.apple.Xcode[110] Xcode (110,0xb0103000) malloc: free_garbage: garbage ptr = 0x318bda0, has non-zero refcount = 1 3/18/08 8:33:18 AM [0x0-0xd00d].com.apple.Xcode[110] Xcode (110,0xb0103000) malloc: free_garbage: garbage ptr = 0x3245320, has non-zero refcount = 1 3/18/08 8:33:26 AM [0x0-0xd00d].com.apple.Xcode[110] Xcode (110,0xb0103000) malloc: free_garbage: garbage ptr = 0x3047dc0, has non-zero refcount = 1 3/18/08 8:33:26 AM [0x0-0xd00d].com.apple.Xcode[110] Xcode (110,0xb0103000) malloc: free_garbage: garbage ptr = 0x308a7c0, has non-zero refcount = 1 3/18/08 8:34:05 AM Xcode[110] Xcode(110,0xb0103000) malloc: free_garbage: garbage ptr = 0x34d2750, has non-zero refcount = 1 3/18/08 8:34:05 AM Xcode[110] Xcode(110,0xb0103000) malloc: free_garbage: garbage ptr = 0x34ef4d0, has non-zero refcount = 1 3/18/08 8:34:05 AM [0x0-0xd00d].com.apple.Xcode[110] Xcode (110,0xb0103000) malloc: free_garbage: garbage ptr = 0x34d2750, has non-zero refcount = 1 3/18/08 8:34:05 AM [0x0-0xd00d].com.apple.Xcode[110] Xcode (110,0xb0103000) malloc: free_garbage: garbage ptr = 0x34ef4d0, has non-zero refcount = 1 3/18/08 8:34:50 AM Xcode[110] Xcode(110,0xb0103000) malloc: free_garbage: garbage ptr = 0x3292dd0, has non-zero refcount = 1 3/18/08 8:34:50 AM Xcode[110] Xcode(110,0xb0103000) malloc: free_garbage: garbage ptr = 0x3295380, has non-zero refcount = 1 3/18/08 8:34:50 AM [0x0-0xd00d].com.apple.Xcode[110] Xcode (110,0xb0103000) malloc: free_garbage: garbage ptr = 0x3292dd0, has non-zero refcount = 1 3/18/08 8:34:50 AM [0x0-0xd00d].com.apple.Xcode[110] Xcode (110,0xb0103000) malloc: free_garbage: garbage ptr = 0x3295380, has non-zero refcount = 1 3/18/08 8:35:12 AM momc[685] momc compiling for 10.4 target 3/18/08 8:35:22 AM Xcode[110] Xcode(110,0xb0103000) malloc: free_garbage: garbage ptr = 0x35848b0, has non-zero refcount = 1 3/18/08 8:35:22 AM Xcode[110] Xcode(110,0xb0103000) malloc: free_garbage: garbage ptr = 0x358bc40, has non-zero refcount = 1 3/18/08 8:35:22 AM [0x0-0xd00d].com.apple.Xcode[110] Xcode (110,0xb0103000) malloc: free_garbage: garbage ptr = 0x35848b0, has non-zero refcount = 1 3/18/08 8:35:22 AM [0x0-0xd00d].com.apple.Xcode[110] Xcode (110,0xb0103000) malloc: free_garbage: garbage ptr = 0x358bc40, has non-zero refcount = 1 3/18/08 8:35:50 AM Xcode[110] Xcode(110,0xb0103000) malloc: free_garbage: garbage ptr = 0x3432ea0, has non-zero refcount = 1 3/18/08 8:35:50 AM Xcode[110] Xcode(110,0xb0103000) malloc: free_garbage: garbage ptr = 0x345e130, has non-zero refcount = 1 3/18/08 8:35:50 AM [0x0-0xd00d].com.apple.Xcode[110] Xcode (110,0xb0103000) malloc: free_garbage:
Re: CoreData code working on Tiger - not on Leopard
Folks; I have a little more data on this issue: After I have done any insert, if I subsequently call - processPendingChanges I get an error in CoreData. There are no pending messages in the log and no custom catch blocks (other than what is show below). The debugger halts on the @try command The Code: @try { [moc processPendingChanges]; } @catch ( NSException *e ) { NSLog(@"%@: Caught %@: %@", NSStringFromSelector(_cmd), [e name], [e reason]); } The Log: Program received signal: “EXC_BAD_ACCESS”. The Stack: #0 0x93d736ec in objc_msgSend #1 0x9649aed1 in -[NSManagedObjectContext (_NSInternalChangeProcessing) _registerUndoForOperation:withObjects:withExtraArguments:] #2 0x9649adef in -[NSManagedObjectContext (_NSInternalChangeProcessing) _registerUndoForInsertedObjects:] #3 0x9649a038 in -[NSManagedObjectContext (_NSInternalChangeProcessing) _processRecentChanges:] #4 0x964adbea in -[NSManagedObjectContext processPendingChanges] #5 0x00089636 in +[DataImporter importSuppotDataInContext:] at DataImporter.m:75 The Maddening Part: All of the code works like a charm on Tiger. I know I must be missing something pretty basic in the Leopard world but I sure would appreciate a pointer to what that might be! Thanks! Steve On Mar 18, 2008, at 2:33 AM, Steve Cronin wrote: Folks; I am now testing a Tiger application on Leopard and learning the new Leopard way at the same time. I admit I have a lot of Leoparding to do! I use Core Data (SQLite) pretty extensively on Tiger - life is good. I take the project and run it without any changes to the model or the code and Core Date won't save to disk. I load a set of data on initial launch and at the end of that process I have Core Data 'save'. The data loading all appears to run fine: recX = [NSEntityDescription insertNewObjectForEntityForName:@"XYZ" inManagedObjectContext:moc]; [recX setValue:@"123" forKey:@"source"]; ... 5 different entities and 1,000s of records.. I've looked over the 'Core Data - Release Notes' but I don't see anything that seems to indicate a model conversion or persistant store conversions I have not made any changes (no versioning...) Here's the 'save' code: - (void) updateCoreData { NSManagedObject *moc = [self managedObjectContext]; [moc processPendingChanges]; if ([moc commitEditing]) { NSError *error; if ([moc save:&error]) { if (error!=nil) { On Leopard in the 'processPendingChanges' invocation I get the following: 0 0x900ef0f4 in ___TERMINATING_DUE_TO_UNCAUGHT_EXCEPTION___ #1 0x93d680fb in objc_exception_throw #2 0x9649a2a5 in -[NSManagedObjectContext (_NSInternalChangeProcessing) _processRecentChanges:] #3 0x964adbea in -[NSManagedObjectContext processPendingChanges] #4 0x0002032e in -[AppDelegate updateCoreData] at AppDelegate.m:700 BTW: I also get a similar error if, during the loading, I try to get a 'count' using a FetchTemplate with a null predicate (works on Tiger) It appears the fetch also causes a 'processRecentChanges) What am I missing? Thanks for your help! Steve ___ 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 [EMAIL PROTECTED]
How to debug this Tiger release error?
Folks; On Tiger, I have an app that has a popup button which allows a user to make a selection from a supporting array. Once a new selection is made a collection of images are redraw in a view. Has been working reasonably well... Now sometimes, not consistently, when the selection is made the app will crash. Sometimes I see the following in the console log: 2008-03-19 01:36:20.231 XYZ[3035] *[XYZMainWindowController setUserSelectedData] XYZ(3035,0xa000d000) malloc: *** error for object 0x315730: double free XYZ(3035,0xa000d000) malloc: *** set a breakpoint in szone_error to debug I have the following environment variables set: NSZombieEnabled(YES) MallocStackLogging(1) and these Global Breakpoints set: [NSException raise] szone_error [NSObject setNilValueForKey] -[_NSZombie release] malloc_printf The crash doesn't appear to fire any of these breakpoints and leaves only this meager trace in the stack: #0 0x90a594c7 in objc_msgSend #1 0x00315730 in ?? #2 0x90824f84 in __CFDictionaryDeallocate #3 0x9080e0c6 in _CFRelease #4 0x927dc96f in NSPopAutoreleasePool #5 0x9328fab1 in -[NSApplication run] #6 0x932839c0 in NSApplicationMain#7 0x00405ffc in main at main.m:18 If I step thru the code it eventually starts off into the assembly code for handling the interface and bindings and as you all are well aware there is an astonishing amount of such code underlying the Mac OS interface If I pause the app and enable a breakpoint on [NSObject release] I get so many breaks that I just can't make any headway. How DO I -- most efficiently -- figure out what dictionary is the culprit in frame 2 above? Thanks for any help! Steve ___ 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 [EMAIL PROTECTED]
__setjmp linking error in Leopard
Folks; I'm trying to build a test case for a DTS support incident regarding an issue I posted earlier concerning CoreData in Leopard. I have an existing app which compiles without inicident on both Tiger & Leopard. To build the DTS test project, in Leopard I added the data model and several supporingt classes from this existing app, as well as the AppDelegate. I stripped out all the unnecessary code. I confirmed that all the build settings are identical. I did not write a single line of new code. I have the enable ObjC exceptions option turned ON. When I compile on Leopard I get: "__setjmp", referenced from: +[XYZBase allActiveInContext:] in XYZBase.o +[XYZXBase allActiveInContext:] in XYZBase.o +[XYZManagedObject allInContext:] in XYZManagedObject.o +[XYZManagedObject allInContext:] in XYZManagedObject.o -[AppDelegate(PrivateUtilities) setupDefaultSQLLiteStore] in AppDelegate.o -[AppDelegate(PrivateUtilities) setupDefaultSQLLiteStore] in AppDelegate.o +[Owner loadOwnerInContext:] in Owner.o +[Owner loadOwnerInContext:] in Owner.o +[DataImporter importSupportDataInContext:] in DataImporter.o +[DataImporter importSupportDataInContext:] in DataImporter.o ld: symbol(s) not found collect2: ld returned 1 exit status Build failed (1 error) All of the cited classes contain @try - @catch blocks. Is there another compiler setting I an not aware of? When I compile on Tiger: life is good! No warnings, no errors, runs flawlessly... Identical compiler settings! Man I had no idea how much grief I was going to run into just to get running on Leopard!!! I haven't even execised the bulk of the code I'm just trying to get out of -init! Thanks for any thoughts on this compiler matter! Steve ___ 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 [EMAIL PROTECTED]
Consistent Contextual Menu in NSTableview
Folks; I'm having some difficulty getting consistent contextual menu behavior in NSTableView. In the Finder and iTunes (what I feel most users are familiar with) if a row is selected but the user causes a contextual menu on a different row then row selection changes. (I don't want to start a UI flame about 'correctness') I'm only interested in consistency!! NOTE: the contextual menu can appear by a right mouse click, a two- fingered tap, and a control-click which appear to be detected as different events (see below) The base NSTableView class does NOT change the selection when a contextual click occurs on a row If I sub-class and add: - (void)rightMouseDown:(NSEvent *)theEvent { [self selectRow:[self rowAtPoint:[self convertPoint:[theEvent locationInWindow] fromView:nil]] byExtendingSelection:NO]; [super rightMouseDown:theEvent]; } I get half-way home. Now the right mouse click and the two-fingered tap will alter the selection. BUT the control-click does not. The Cocoa adage, "if you are working too hard, you probably are" keeps rummaging around my brain What is the preferred means to efficiently make consistent contextual menu behavior like Finder and iTunes? Thanks, Steve ___ 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 [EMAIL PROTECTED]
AppleScript - occasional crashes on Leopard
Folks; I've seen some inconsistent behavior on AppleScript running under Leopard. Here's an example: ... NSString *theScript =@"some valid dynamic script text" NSDictionary *errorDict = [NSDictionary dictionary]; NSAppleScript *appleScriptObject = [[NSAppleScript alloc] initWithSource:theScript]; NSAppleEventDescriptor *eventDescriptor = [appleScriptObject executeAndReturnError: &errorDict]; ... will OCCASIONALLY crash at the NSAppleEventDescriptor specification: #0 0x932c3d5c in getDescDataType #1 0x932c7ab7 in aeCoerceDescInternal #2 0x932cc055 in AECoerceDesc #3 0x1d4a8150 in ComponentCoerceDesc #4 0x1d48cbec in ASCompile #5 0x903bacb8 in CallComponentFunction #6 0x1d487ae2 in AppleScriptComponent #7 0x1d4a3927 in AGenericManager::HandleOSACall #8 0x903755cd in CallComponentDispatch #9 0x953fc513 in OSACompile #10 0x93e6edaf in -[NSAppleScript compileAndReturnError:] #11 0x93e6f096 in -[NSAppleScript(NSPrivate) _executeWithMode:andReturnError:] #12 0x93e6ee51 in -[NSAppleScript executeAndReturnError:] Is there a new/better means in Leopard of accomplishing the execution of dynamic scripts? NO the crash is NOT related to the validity of the script, of this I am absolutely certain! (It only crashes sometimes using the same resulting script!!) Is a dual processor Intel creating a risk here? Is there something better I can do to handle the error? Why should I have to use a @try block here? I thought that was what the executeAndReturnError parameter was for!! But I don't get a chance to examine the errorDict. It will crash only every so often My hunch is that crashes are more likely when machine is under load and memory swapping might be involved. This is running on a 4G MacBook... Any wisdom appreciated! Steve ___ 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 [EMAIL PROTECTED]
Re: AppleScript - occasional crashes on Leopard
NO threading involved here. Just straight up Cocoa code... Do you know enough about AS internals to read the stack trace and KNOW that the error is during compilation? If so, why is the error not being propagated back thru errorDict? And the biggest mystery (to me anyway) why only sometimes? Steve On Apr 22, 2008, at 1:10 PM, Nick Zitzmann wrote: On Apr 22, 2008, at 11:47 AM, Steve Cronin wrote: will OCCASIONALLY crash at the NSAppleEventDescriptor specification: Are you using NSAppleScript in the main thread? The only time I've ever seen compiling a script crash was when it was not running in the main thread. Nick Zitzmann <http://www.chronosnet.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 [EMAIL PROTECTED]
Re: AppleScript - occasional crashes on Leopard
Mark; 10 months after the first Leopard seed to developers, 6 months after commercial release, and after 2 system updates to the commercial product, the message to developers using ANY AppleScript in Cocoa is: "No Garbage Collection for you!" Perhaps you can try and understand how this might be potentially irritating to some Turning off Garbage collection has profound impacts on the rest of the code base NOT just AppleScript. As I am sure you are aware, turning off Garbage Collection is WAY more than a compiler switch! For my ongoing better understanding of Cocoa, could you provide a link to where I SHOULD have researched so that I would not end up in this corner. Politely, Steve On Apr 22, 2008, at 2:53 PM, Mark Piccirelli wrote: Is this a garbage-collected app? If so the crash is a known bug. -- Mark On Apr 22, 2008, at 10:47 AM, Steve Cronin wrote: Folks; I've seen some inconsistent behavior on AppleScript running under Leopard. Here's an example: ... NSString *theScript =@"some valid dynamic script text" NSDictionary *errorDict = [NSDictionary dictionary]; NSAppleScript *appleScriptObject = [[NSAppleScript alloc] initWithSource:theScript]; NSAppleEventDescriptor *eventDescriptor = [appleScriptObject executeAndReturnError: &errorDict]; ... will OCCASIONALLY crash at the NSAppleEventDescriptor specification: #0 0x932c3d5c in getDescDataType #1 0x932c7ab7 in aeCoerceDescInternal #2 0x932cc055 in AECoerceDesc #3 0x1d4a8150 in ComponentCoerceDesc #4 0x1d48cbec in ASCompile #5 0x903bacb8 in CallComponentFunction #6 0x1d487ae2 in AppleScriptComponent #7 0x1d4a3927 in AGenericManager::HandleOSACall #8 0x903755cd in CallComponentDispatch #9 0x953fc513 in OSACompile #10 0x93e6edaf in -[NSAppleScript compileAndReturnError:] #11 0x93e6f096 in -[NSAppleScript(NSPrivate) _executeWithMode:andReturnError:] #12 0x93e6ee51 in -[NSAppleScript executeAndReturnError:] Is there a new/better means in Leopard of accomplishing the execution of dynamic scripts? NO the crash is NOT related to the validity of the script, of this I am absolutely certain! (It only crashes sometimes using the same resulting script!!) Is a dual processor Intel creating a risk here? Is there something better I can do to handle the error? Why should I have to use a @try block here? I thought that was what the executeAndReturnError parameter was for!! But I don't get a chance to examine the errorDict. It will crash only every so often My hunch is that crashes are more likely when machine is under load and memory swapping might be involved. This is running on a 4G MacBook... Any wisdom appreciated! Steve ___ 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/markp%40apple.com This email sent to [EMAIL PROTECTED] ___ 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 [EMAIL PROTECTED]
A Cocoa means to detect SysPref 'Enable access for assistive devices"
Folks; Is there a straight Cocoa means to detect the System Preferences/ Universal Access setting for 'Enable access for assistive devices'? I've found plenty of references on using Applescript to detect this setting. The Cocoa Assistive API seems pretty extensive but I can't glean a way to just determine this setting using Cocoa... I understand the potential 'admin' aspects of the setting. All I want is a means to know what the current setting is. Any links or code snippets appreciated! Steve ___ 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 [EMAIL PROTECTED]