Re: I've Got Those NSKeyedUnarchiver Blues!
On 4 Dec 2011, at 23:09, Jens Alfke wrote: > >> *** -[NSKeyedUnarchiver decodeObjectForKey:]: cannot decode object of class >> (SplitsTestSet) >> >> I really don't understand why this is happening. I'm convinced it's >> not a problem with library linking, as these apps have no problem >> instantiating various objects sourced from the library. (Almost all >> my Googling about this exception seem to be down to bad linking.) > > My suspicion is that the class SplitsTestSet is getting dead-stripped from > the Trainer app. Try adding the line “[SplitsTestSet class]” somewhere in the > code, just to force a reference to the class-name so it won’t get stripped. This worked once I did the same for one of the four other library classes that SplitsTestSet used. As my projects use all the classes the library provides, I'll stick to the -ObjC linker flag solution; adding code to solve what seems to be a problem with over-enthusiastic link optimisation is anathema to me. However, this solution would definitely be worth using if I was using only a tiny fraction of a large library. > Also try looking at the binary using the ‘nm’ tool to check whether the class > symbols exist in the app. Yes, this made it crystal clear - thanks for pointing me at 'nm' and helping me understand the solutions. Stuart ___ 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: Escape xml with CFXMLCreateStringByEscapingEntities
On Dec 1, 2011, at 9:19 AM, Claude Saelens wrote: > Hello, > > I need to put XML fragments into another XML. Each time an XML fragment is > put into another XML it needs to be escaped to be send to backend a java > application. I used the function "CFXMLCreateStringByEscapingEntities" but it > seems it can only escape an XML fragment once, the second time strange > characters are added. > > For this is wrote following method: > > -(NSMutableString*)xmlEscape:(NSMutableString*)xmlString > { > NSMutableString *aNSString = [NSMutableString > stringWithString:xmlString]; > CFStringRef aCFString; > CFStringRef bCFString; > aCFString = CFStringCreateWithCString(NULL, [aNSString UTF8String], > NSUTF8StringEncoding); > bCFString = CFXMLCreateStringByEscapingEntities(kCFAllocatorDefault, > aCFString, NULL); > > NSMutableString *returnValue = [NSMutableString > stringWithString:(NSMutableString*)bCFString]; > > CFRelease(aCFString); > CFRelease(bCFString); > > return returnValue; > } > > The result is as follow: > > First fragment: > > > Links/lets&dance.jpg > 0 > > > Links/doubles_1/lets&dance.jpg > 0 > > > Escaping this and put in a second fragment gives: > > > 4_2 >- >
>- Links/lets&dance.jpg
>- 0
>- >
> > > > Escaping this fragment again gives: > >- name="path">Links/doubles_1/lets&dance.jpg
>- 0
>- >
> > > Has anyone a solution for this problem? > > Thanks a lot for your help. You didn't show the relevant code. (Your code above performs a couple of unnecessary copies). On Lion 10.7.2, using Xcode 4.2.1 with default Foundation Template, this works for me: int main (int argc, const char * argv[]) { @autoreleasepool { CFStringRef input = CFSTR("\n" "Links/lets&dance.jpg\n" "0\n" "\n" "\n" "Links/doubles_1/lets&dance.jpg\n" "0\n" ""); NSLog(@"input:\n%@\n\n", input); CFStringRef firstOut = CFXMLCreateStringByEscapingEntities( kCFAllocatorDefault, input, NULL); NSLog(@"output:\n%@\n\n", (id)firstOut); NSString* format = @"\n" @"4_2\n" @"%@\n" @""; NSString* second = [NSString stringWithFormat:format, (id)firstOut]; CFStringRef secondOut = CFXMLCreateStringByEscapingEntities( kCFAllocatorDefault, (CFStringRef)second, NULL); NSLog(@"secondOut:\n%@\n\n", (id)secondOut); CFRelease(firstOut); CFRelease(secondOut); } return 0; } 2011-12-02 14:06:21.593 XMLEscape[61121:707] input: Links/lets&dance.jpg 0 Links/doubles_1/lets&dance.jpg 0 2011-12-02 14:06:21.595 XMLEscape[61121:707] output:- 4_2
>- قÄ-<قÄ،item > typeقÄ-="قÄ،StructقÄ-">قÄ، > قÄ-<قÄ،item > nameقÄ-="قÄ،pathقÄ-">قÄ،Links/lets&dance.jpgقÄ-</قÄ،itemقÄ->قÄ، > قÄ-<قÄ،item > nameقÄ-="قÄ،spread_indexقÄ-">قÄ،0قÄ-</قÄ،itemقÄ->قÄ، > قÄ-</قÄ،itemقÄ->قÄ، > قÄ-<قÄ،item typeقÄ-="قÄ،StructقÄ-">قÄ، > قÄ-<قÄ،item > nameقÄ-="قÄ،pathقÄ-">قÄ،Links/doubles_1قÄ-/قÄ،lets&dance.jpgقÄ-</قÄ،itemقÄ->قÄ، > قÄ-<قÄ،item > nameقÄ-="قÄ،spread_indexقÄ-">قÄ،0قÄ-</قÄ،itemقÄ->قÄ، > قÄ-</قÄ،itemقÄ->قÄ، >
>- Links/lets&dance.jpg
- 0
- 2011-12-02 14:06:21.596 XMLEscape[61121:707] secondOut:
- Links/doubles_1/lets&dance.jpg
- 0
- 4_2
- <item type="Struct"> <item name="path">Links/lets&dance.jpg</item> <item name="spread_index">0</item> </item> <item type="Struct"> <item name="path">Links/doubles_1/lets&dance.jpg</item> <item name="spread_index">0</item> </item>
Re: Escape xml with CFXMLCreateStringByEscapingEntities
On 4 Dec 2011, at 10:42 AM, Jens Alfke wrote: > It looks like you’re trying to convert an NSString to a CFString through a > whole bunch of conversions; but all this takes is a simple cast: For more information on this, by the way, check "Toll-Free Bridging" in the developer docs; instances of some (but not all) CF "classes" are interchangeable with their ObjC counterparts. ___ 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: NSViewController KVO compliance
Unfortunately, if the doc doesn’t mention it specifically, don’t assume that it is and always will be, even with evidence. You can check the headers to see (and if there is a mismatch, mention it in a bug) File a bug asking for clarification. which you have. This goes for all hopefully-KVO compliant properties. Sending a bug that says please document all KVO-compliant properties isn’t necessary (or really helpful) because that’s in progress as we come across them. But on a per class basis, if you’re not sure about a property, go and file the bug. And a single bug for multiple properties in a class is fine, so Kyle didn’t need to knock himself out. :-) But thanks for filing. Scott On Dec 2, 2011, at 2:30 PM, Kyle Sluder wrote: > The NSViewController documentation and header file do not mention if > NSViewController is KVO-compliant for its view property. The docs > mention that it is KVO-compliant for title and representedObject, and > the headerdoc comments mention KVO-compliance for representedObject > but not for title. > > Can anyone on this list give a definitive answer to the KVO-compliance > of NSViewController.view? I've already filed rdar://problem/10497897 > and rdar://problem/10498295 about view and title respectively. ___ 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 would a working -[NSInvocation invoke] call NSBeep() ?
On Dec 4, 2011, at 5:49 PM, Jerry Krinock wrote: > At one point, running in Mac OS 10.7, one of my invocations gets invoked, and > … > > #00x913761fa in NSBeep > #10x9b6f0e1d in __invoking___ > #20x9b6f0d59 in -[NSInvocation invoke] > #30x976458ea in __NSFireDelayedPerform > #40x9b6b0996 in __CFRUNLOOP_IS_CALLING_OUT_TO_A_TIMER_CALLBACK_FUNCTION__ > … > > Everything works perfectly except that the stupid beep is annoying. > > The invocation targets NSApplication with selector > -beginSheet:modalForWindow:modalDelegate:didEndSelector:contextInfo:. I > looked at it in gdb using "Mac OS X Debugging Magic". The target, selector, > and arguments all look fine. > > The sheet appears before the beep. The method -[NSInvocation invoke] shows > 92 lines of assembly code. It looks like, indeed, the actual invocation is > done first, and then at line 41 it calls this __invoking__ thing, which is 48 > lines of assembly code, and for some reason at line 15 it calls NSBeep(). > > Does anyone have any idea why -[NSInvocation invoke] might call NSBeep()? NSBeep() is being called by -beginSheet:modalForWindow:... . Compiler optimization ("tail-call optimization") means that the -beginSheet:... frame is absent from the stack trace. -beginSheet:... calls NSBeep() in some error case. I don't understand the code myself, but I'd guess that it's complaining because there's already a sheet open on that window. Perhaps you're calling -beginSheet: twice, and the first call works and the second call just beeps. You should file a bug report asking for -beginSheet:... to log a real error message or throw an exception instead of beeping. -- Greg Parker gpar...@apple.com Runtime Wrangler ___ 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
NSComboBoxCell drop down programmatically
Is it possible to simulate that a user clciks an arrow in NSComboBoxCell in NSTableView? I mean to do this programmatically? I have an application that have the requirement that the line of the NSComboBoxCell is to be selected, and the have the comboboxcell drop down. the selection part of it was easy, but i can't find any method to make the combo cell to open.___ 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
NSToolbar breaks auto layout constraints of NSSplitView in window
I have a .xib file that uses auto layout. I setup a window with a sidebar using NSSplitView and NSOutlineView. Everything was working well with resizing the window until I added a NSToolbar. Things continued to look good when I resized the window in IB but not when the app is run. When the window's height is resized, the split view is no longer pinned to the top of its superview. I tried the same thing in a window of another .xib file and got the same result except that this time it was the bottom of the split view that was no longer pinned. Adding user defined constraints did not correct the problem. Removing the toolbar results in proper behavior again. Has anyone else experienced this problem? Am I missing something obvious? Any ideas for a workaround? Thanks for your help. using Xcode 4.2.1. Sean Todd Mac Software Developer XGrader Toads End Software ___ 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
Alternate Framework location
Hello, I've been reading through the developer docs and I'm not sure I can do what I want so I thought I would ask. I have created a Foundation tool and I have created a private framework. All works great if I install my framework in /Library/Frameworks. What I would like to know is, can I install my framework in /usr/local/frameworks as an example and have my foundation tool automatically find it? I would assume I would have to add a search path or something but I'm not sure where. Thanks, tom___ 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: Alternate Framework location
On 5 Dec 2011, at 5:11 PM, TomJones wrote: > I've been reading through the developer docs and I'm not sure I can do what I > want so I thought I would ask. I have created a Foundation tool and I have > created a private framework. All works great if I install my framework in > /Library/Frameworks. What I would like to know is, can I install my framework > in /usr/local/frameworks as an example and have my foundation tool > automatically find it? I would assume I would have to add a search path or > something but I'm not sure where. If the framework will always be installed in /usr/local/frameworks, then this is easy enough: you can set the framework's install path to any path when it is built. When something is linked against that framework, the framework's install path is stored in the tool so that it can find the framework at runtime. There are some magic values you can use in the path to help out; see the end of the dyld man page: http://developer.apple.com/library/mac/documentation/Darwin/Reference/Manpages/man1/dyld.1.html If you want the tool to search in multiple places at run time for the framework, that's harder. There are a couple of ways to arrange for that, but the easiest way is for the tool to actually live inside the framework (or at a known location relative to it), use the @executable_path or @rpath variable to find it, and in bin you can put either a symlink or a shell script to invoke the tool at its installed location. The shell script could alternately find the framework using whatever algorithm you like and then set DYLD_FRAMEWORK_PATH before invoking the real tool. ___ 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