Passing arrays via WSMethodInvocationInvoke() [WebServicesCore]
I'm writing some Objective-C (actually Objective-C++) code to create a Cocoa framework to call into a Web Service (hosted in ASP.NET) using WSMethodInvocationInvoke(), based on the example from here: http://developer.apple.com/internet/webservices/webservicescoreandcfnetwork.html This works great for Web Service calls which take simple parameters (basically key-value pairs of strings), for example: NSDictionary *params = [NSDictionary dictionaryWithObject:@test forKey:@GroupName]; To call a method like so (leaving off some of the outer soap:Envelope tags and such): soap:Body ListSubGroups xmlns=foo GroupNametest/GroupName /ListSubGroups /soap:Body And I can get responses with simple parameters (such as a returned string) as well, like so: NSDictionary *result = (NSDictionary *)WSMethodInvocationInvoke (soapReq); NSString *resultField = [result objectForKey:@ListSubGroupsResult]; To parse a response like: soap:Body ListSubGroupsResponse xmlns=foo ListSubGroupsResultReturn Value Here/ListSubGroupsResult /ListSubGroupsResponse /soap:Body Things get more complicated, though, when dealing with array parameters (string[] in the C# source code of the Web Service). I've figured out how to process a return value (output parameter) which is an array (of strings), like so: soap:Body ListSubGroupsResponse xmlns=foo ListSubGroupsResult stringGroup1/string stringGroup2/string /ListSubGroupsResult /ListSubGroupsResponse /soap:Body With code like this: NSDictionary* resultField = [result objectForKey:@ListSubGroupsResult]; id names = [resultField valueForKey:@string]; NSString* Items = nil; int count = 0; if ([names isKindOfClass:[NSString class]]) { count = 1; Items = (NSString*)names; } else if ([names isKindOfClass:[NSArray class]]) { count = [(NSArray*)names count]; Items = [(NSArray*)names componentsJoinedByString:@\t]; } However, I'm stymied trying to generate a call to a function that takes an array as an input parameter, like this: soap:Body MethodWithArrayParam xmlns=foo Data stringValue1/string stringValue2/string /Data /MethodWithArrayParam /soap:Body If I try to duplicate what I get back in the return parameter case (above), by creating an NSArray and adding it to a NSDictionary with the key string, like so: NSArray* values; // init not shown // ... NSDictionary* valuesDict = [NSDictionary dictionaryWithObject:values forKey:@string]; NSDictionary *params = [NSDictionary dictionaryWithObject: valuesDict forKey:@Data]; Then the calling markup ends up like this (leaving off some of the extraneous xsi:type attributes and such): soap:Body MethodWithArrayParam xmlns=foo Data string item_0Value1/item_0 item_1Value2/item_1 /string /Data /MethodWithArrayParam /soap:Body And the Web Service doesn't recognize those tags, so I get a fault response. I can get rid of the intermediate NSDictionary, but the NSArray is still serialized as item_0, item_1, etc. And AFAIK an NSDictionary can't have more than one key named string to generate the multiple string tags. I can't find any combination of NSArray, NSDictionary, or any other Cocoa objects that will serialize properly. Again, what the Web Service wants is something like: Data stringValue1/string stringValue2/string stringValue3/string /Data Which ends up as a string[] (array of string) parameter in the C# code of my ASP.NET Web Service. Here's a live, public example of a similar Web Service method with the same kind of input array parameter (from someone else's site, found via Google): http://www.chemspider.com/Search.asmx?op=CSID2ExtRefs I found this old post which seems to describe the same problem, but there were no responses: http://lists.apple.com/archives/cocoa-dev/2004/Mar/msg01729.html http://www.cocoabuilder.com/archive/message/cocoa/2004/3/26/102571 Now, as that post suggests, I've tried using a workaround using WSMethodInvocationAddSerializationOverride(), similar to the one in this post: http://lists.apple.com/archives/Macnetworkprog/2009/Apr/msg00063.html The serialization function is: static CFStringRef _arrayToXML(WSMethodInvocationRef invocation, CFTypeRef obj, void *info) { if (obj != nil (CFGetTypeID(obj) == CFArrayGetTypeID())) { NSArray* array = (NSArray*)obj; NSMutableString* result = [[NSMutableString alloc] initWithFormat:@%s, %@]; for (int i = 0; i [array count]; i++) [result appendFormat:@string%@/string, [array objectAtIndex:i]]; [result appendFormat:@/%s, %@]; return (CFStringRef)result; } return NULL; } Which allows the entry in the parameter dictionary to be an NSArray, and it generates the right
Re: WebView in a layer view hierarchy - not working on Snow Leopard
WebView's don't support being layer-backed. But there is a private WebUIDelegate method that will let you achieve what you want: - (void)webView:(WebView *)sender didDrawRect:(NSRect)rect; On 24 Oct 2009, at 00:53, Luke Evans wrote: I have an app that plain stopped working between Leopard and Snow Leopard. This app relies on placing a WebView component in a Core Animation layer view hierarchy (i.e. Needs Core Animation Layer flag is turned on for this view and its superviews), so that I can draw annotations over the web content with a mostly-transparent 'glass view' in a layer above. What I've found so far is that if I turn off the Needs Layer flag on the WebView and all its superviews, then the web content is visible. If I leave this flag on however, then all I get is a plain white area, with no web content visible (though this continues to be loaded). I have logged this as a bug already - mostly because its a behaviour change between Leopard and Snow Leopard, and I have not found any documentation that indicate this is an intentional change. However, it _might_ be intentional, or possibly I was already flying by the seat of my pants to have it working in the first place. In any case, perhaps somebody has some concrete knowledge on the subject...? Cheers -- Luke ___ 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/cocoadev%40mikeabdullah.net This email sent to cocoa...@mikeabdullah.net ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Force subviews to stay in place during live resize
I'm creating a view containing different subviews programmatically. Like this: 1 - NSOutlineView 2 - NSView 3 - NSView Added according to the choice made in NSOutlineView: 4 - NSView 5 - NSView 6 - NSView The window is only resized in height. The fact is that when 4, 5 and 6 are added and that the window resize, 1,2 and 3 don't stay in place during the animation. They seem to be removed and then the animation show 6, 5, 4, 3, 2 and 1 How can I do to force 1, 2 and 3 to stay where they are during the live resize ? A bit difficult to explain as I'm French thus If you want a video I can make one later. ___ 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
Crash drawing image
Hello! I'm getting a random “EXC_BAD_ACCESS” on this line: [sourceImage compositeToPoint:NSMakePoint(0, height) operation:NSCompositeCopy]; sourceImage is an iTunes artwork, or a generic artwork icon if the current track has none. The crash ONLY happens with this generic icon (and only at random). The (retained) image is valid at the time of the crash and looks like this: NSImage 0x2003c7140 Size={600, 600} Reps=( NSBitmapImageRep 0x2004295c0 Size={600, 600} ColorSpace=iMac colorspace BPS=8 BPP=24 Pixels=600x600 Alpha=NO Planar=NO Format=0 CurrentBacking=CGImageRef: 0x2003c4f60 CGImageSource=0x2000af320 ) Here's my full code: + (NSImage *)appendReflectionToImage:(NSImage *)sourceImage fraction:(float)fraction { NSSize size = [sourceImage size]; float width = size.width; float height = size.height * fraction; NSImage *reflection = [[NSImage alloc] initWithSize:NSMakeSize(width, height)]; [reflection setFlipped:YES]; [reflection lockFocus]; [sourceImage drawAtPoint:NSZeroPoint fromRect:NSZeroRect operation:NSCompositeSourceOver fraction:1.0]; NSGradient *gradient = [[NSGradient alloc] initWithStartingColor:[NSColor colorWithDeviceWhite:0.0 alpha:0.5] endingColor:[NSColor colorWithDeviceWhite:0.0 alpha:1.0]]; [gradient drawInRect:NSMakeRect(0, 0, width, height) angle:90]; [reflection unlockFocus]; NSImage *destinationImage = [[NSImage alloc] initWithSize:NSMakeSize(width, size.height + height)]; [destinationImage lockFocus]; [reflection compositeToPoint:NSZeroPoint operation:NSCompositeCopy]; [sourceImage compositeToPoint:NSMakePoint(0, height) operation:NSCompositeCopy]; // CRASHES HERE, ALWAYS SAME IMAGE [destinationImage unlockFocus]; [destinationImage setScalesWhenResized:YES]; return destinationImage; } The project is a (GC enabled) screen saver, which makes it kind of hard to debug. I'm running it attached to the Screen Saver Engine. When the crash happens, I get the spinning beach ball until I terminate the process, so I cannot investigate it any further (I think?). Anyway, this is what I get from the debugger: Program received signal: “EXC_BAD_ACCESS”. Error while running hook_stop: Error while running hook_stop: Invalid type combination in ordering comparison. Error while running hook_stop: Invalid type combination in ordering comparison. Error while running hook_stop: Error while running hook_stop: Error while running hook_stop: Error while running hook_stop: Error while running hook_stop: Error while running hook_stop: Error while running hook_stop: Unable to disassemble ripc_RemoveEntry. Any ideas what the problem might be? I never had this crash before enabling GC (but have also altered the code above since then so this might not mean anything). Thank you. 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
Re: Force subviews to stay in place during live resize
On Oct 24, 2009, at 9:53 AM, Stamenkovic Florijan wrote: On Oct 24, 2009, at 08:42, Zephyroth Akash wrote: I'm creating a view containing different subviews programmatically. Like this: 1 - NSOutlineView 2 - NSView 3 - NSView This tells almost nothing to the list. Post code. Added according to the choice made in NSOutlineView: 4 - NSView 5 - NSView 6 - NSView The window is only resized in height. The fact is that when 4, 5 and 6 are added and that the window resize, 1,2 and 3 don't stay in place during the animation. They seem to be removed and then the animation show 6, 5, 4, 3, 2 and 1 How can I do to force 1, 2 and 3 to stay where they are during the live resize ? This is most likely happening because you are not configuring the auto-resizing for the subviews properly. And possibly you are assuming the wrong coordinate system. Seeing that you most likely did not read the following yet, do it now, start to finish: http://developer.apple.com/mac/library/documentation/Cocoa/Conceptual/CocoaViewsGuide/index.html You should read the whole thing, but I'm guessing the View Geometry section will be especially helpful. Also search the docs for autoresizingMask. --Andy 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/aglee%40mac.com This email sent to ag...@mac.com ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: NSComboBoxCell in a NSTableView
On Oct 24, 2009, at 10:04, Timothy Reaves wrote: What is the correct way to size this? I have it added, and it's used. But by default, it doesn't size to hold it's content. I can set he width of the table column to a better width, but I can't seem to find how to size the height. Is there any way to get the table view - or column - to auto-size to correctly hold the combo box cell? -[NSTableView setRowHeight] NSTableView won't autosize, but somewhere in your code you can set the row height to the height of the cell. Also you might consider setting a different control size on the cell. 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
Re: NSComboBoxCell in a NSTableView
On Oct 24, 2009, at 10:32 AM, Stamenkovic Florijan wrote: On Oct 24, 2009, at 10:04, Timothy Reaves wrote: What is the correct way to size this? I have it added, and it's used. But by default, it doesn't size to hold it's content. I can set he width of the table column to a better width, but I can't seem to find how to size the height. Is there any way to get the table view - or column - to auto-size to correctly hold the combo box cell? -[NSTableView setRowHeight] NSTableView won't autosize, but somewhere in your code you can set the row height to the height of the cell. Also you might consider setting a different control size on the cell. F Thanks for that. I guessed I overlooked it because the width is set on the column, and I figured that is where the height would be too. ___ 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: Crash drawing image
On Oct 24, 2009, at 6:51 AM, slasktrattena...@gmail.com wrote: When the crash happens, I get the spinning beach ball until I terminate the process, so I cannot investigate it any further (I think?). Anyway, this is what I get from the debugger: Program received signal: “EXC_BAD_ACCESS”. Error while running hook_stop: Error while running hook_stop: It would be really good to get a backtrace. Are you launching the process with gdb, or at least attaching before the crash? And after the crash, gdb is confused and can't get info about the process? Hm. If you run without gdb, do you get a regular unexpectedly quit alert with the option to send a crash report (which includes a backtrace)? Have you tried running with malloc in scribbling/heap-checking mode, to see if anything funky's going on with the heap? ('man malloc' for details on the environment variables to set for this.) —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
Re: Crash drawing image
Thanks for your reply. On Sat, Oct 24, 2009 at 6:03 PM, Jens Alfke j...@mooseyard.com wrote: It would be really good to get a backtrace. Are you launching the process with gdb, or at least attaching before the crash? Yes. I'm launching with gdb and pass the debug argument to Screen Saver Engine. This way the screen saver is running on the desktop window level. And after the crash, gdb is confused and can't get info about the process? Sort of. I think the problem is no app can have keyboard focus as long as the screensaver is running/frontmost. So Xcode is not responding to keyboard events until I terminate the process. If you run without gdb, do you get a regular unexpectedly quit alert with the option to send a crash report (which includes a backtrace)? No. The process just hangs and I have to force a reboot. Have you tried running with malloc in scribbling/heap-checking mode, to see if anything funky's going on with the heap? ('man malloc' for details on the environment variables to set for this.) I'm not sure what to expect, but I did try just now to enable most of these settings and they didn't return anything that looked helpful in gdb. ___ 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: UITextField in UITableView covered by keyboard
Greg, The sample code is Apple's UICatalog and my view controller IS a subclass of UITableViewController. What's making this so frustrating is that it should just work according to everything I've read, at least in 3.0+. There are some subtle differences between my code and the sample though since I have a tab bar and navigation bar. Also, I've noticed that when debugging UICatalog the tableView instance has an instance variable _keyboardSupport set, but my tableView doesn't. This appears to be package private and I haven't located any documentation about it, but I'm definitely suspicious that it's related in some way. I've tried using the UIKeyboardWillShowNotification/ UIKeyboardWillHideNotification notifications, and in fact, use it successfully in another view, but I didn't look at using contentInset. I'm convinced that this is a bug in the SDK and I'll try to put together a test case to submit to Apple when I get some time. Bob On Oct 24, 2009, at 9:04 AM, Greg Reichow wrote: Hi all, I posted this a yesterday, but it never appeared on the list and it's not showing up in the web archive so I thought I'd retry. I have a UITableView that contains some cells with UITextField's embedded in them. When I touch the UITextField to begin editing the keyboard pops up and obscures the the text field. I've been looking at the UICatalog sample, which has a nearly identical setup and the UITextField scrolls up to make itself visible, but I've been unable to determine what it's doing to cause that. I've read suggestions on scrolling the UITexField rect, resizing the UITableView, etc., but UICatalog doesn't do any of that, yet still works. What am I missing? If your view controller is a subclass of UITableViewController, I believe that it will do the scrolling automatically. (This may explain why the example code did not show anything to make this work; yet, I am not sure sure which specific example you were looking at.) Otherwise, I have used the contentInset property on the UITableView to adjust for the keyboard size (which you get from the UIKeyboardWillShowNotification), and then when the textfield starts editing, tell the tableview to scroll to that cell with the textfield. (scrollToRowAtIndexPath:atScrollPosition) When the keyboard goes away (again the notification will tell you this), you need to undo the change made to the contentInset Greg ___ 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: WebView in a layer view hierarchy - not working on Snow Leopard
Oh-oh. OK, 'tis as I feared then - I was living on a wing and a prayer with Leopard (which did work perfectly in this regard to my use of WebView in a layer-backed view hierarchy - i.e. at the bottom of the stack). I took a look at WebUIDelegate (as I think I had done a long while back, while playing with how to draw over the top of web content). I can't see from the docs how to use such a delegate to draw over the web content. The delegate seems to be empowered to control a lot of the expected user interactions, but I'm not sure how you would draw with it. BTW, I tried subclassing WebView when I was playing with it, way back, but couldn't get the subclass to draw the web content before my annotations. At the time I just called the superclass draw method and then attempted to draw the annotations. Maybe I was being too simplistic about it, and that having my own graphics context or something would have made that work. On 2009-10-24, at 3:36 AM, Mike Abdullah wrote: WebView's don't support being layer-backed. But there is a private WebUIDelegate method that will let you achieve what you want: - (void)webView:(WebView *)sender didDrawRect:(NSRect)rect; On 24 Oct 2009, at 00:53, Luke Evans wrote: I have an app that plain stopped working between Leopard and Snow Leopard. This app relies on placing a WebView component in a Core Animation layer view hierarchy (i.e. Needs Core Animation Layer flag is turned on for this view and its superviews), so that I can draw annotations over the web content with a mostly-transparent 'glass view' in a layer above. What I've found so far is that if I turn off the Needs Layer flag on the WebView and all its superviews, then the web content is visible. If I leave this flag on however, then all I get is a plain white area, with no web content visible (though this continues to be loaded). I have logged this as a bug already - mostly because its a behaviour change between Leopard and Snow Leopard, and I have not found any documentation that indicate this is an intentional change. However, it _might_ be intentional, or possibly I was already flying by the seat of my pants to have it working in the first place. In any case, perhaps somebody has some concrete knowledge on the subject...? Cheers -- Luke ___ 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: Crash drawing image
Weird... It seems that sourceImage (the generic one only) is being garbage collected in the middle of the drawing. If I disable GC just before doing the drawing, and enable it again afterwards, the process stops crashing. I verified this by making a new project, where I placed the screensaver view in a normal window. With GC disabled, there were no crashes. As soon as I enabled GC, it started crashing. Backtrace says: #0 0x91c008c5 in ripc_RemoveEntry () #1 0x91bdd7b0 in ripc_AcquireImage () #2 0x91bdb3be in ripc_DrawImage () #3 0x937eab60 in CGContextDrawImage () #4 0x92c4d3c7 in __-[NSImageRep drawInRect:fromRect:operation:fraction:respectFlipped:hints:]_block_invoke_1 () #5 0x92c4ca4d in -[NSImageRep drawInRect:fromRect:operation:fraction:respectFlipped:hints:] () #6 0x92c4b586 in __-[NSImage drawInRect:fromRect:operation:fraction:respectFlipped:hints:]_block_invoke_1 () #7 0x92c48e1b in -[NSImage _usingBestRepresentationForRect:context:hints:body:] () #8 0x92c48950 in -[NSImage drawInRect:fromRect:operation:fraction:respectFlipped:hints:] () #9 0x92d06d9b in -[NSImage drawInRect:fromRect:operation:fraction:] () #10 0x92d335de in -[NSImage _composite:delta:fromRect:toPoint:] () #11 0x92d32af5 in -[NSImage compositeToPoint:fromRect:operation:] () #12 0x92d32a8d in -[NSImage compositeToPoint:operation:] () #13 0x2acd in +[NSImage(Reflection) appendReflectionToImage:fraction:] (self=0xa03195c0, _cmd=0x9324, sourceImage=0x1251440, fraction=0.5) at /Users/fabian/Lounge/Lounge/NSImage+Reflection.m:29 #14 0x47b0 in -[MainController updateTrackInfo:] (self=0x1026cc0, _cmd=0x908a, dict=0x123a260) at /Users/fabian/Lounge/Lounge/MainController.m:379 #15 0x94b41b65 in __NSFireDelayedPerform () #16 0x93fcbeee in __CFRunLoopRun () #17 0x93fc9d34 in CFRunLoopRunSpecific () #18 0x93fc9b61 in CFRunLoopRunInMode () #19 0x94dbafec in RunCurrentEventLoopInMode () #20 0x94dbada3 in ReceiveNextEventCommon () #21 0x94dbac28 in BlockUntilNextEventMatchingListInMode () #22 0x92c10b99 in _DPSNextEvent () #23 0x92c1040e in -[NSApplication nextEventMatchingMask:untilDate:inMode:dequeue:] () #24 0x92bd25fb in -[NSApplication run] () #25 0x92bca695 in NSApplicationMain () #26 0x2108 in main (argc=0x1, argv=0xb7d4) at /Users/fabian/Lounge/Lounge/main.m:13 On Sat, Oct 24, 2009 at 7:36 PM, slasktrattena...@gmail.com slasktrattena...@gmail.com wrote: Thanks for your reply. On Sat, Oct 24, 2009 at 6:03 PM, Jens Alfke j...@mooseyard.com wrote: It would be really good to get a backtrace. Are you launching the process with gdb, or at least attaching before the crash? Yes. I'm launching with gdb and pass the debug argument to Screen Saver Engine. This way the screen saver is running on the desktop window level. And after the crash, gdb is confused and can't get info about the process? Sort of. I think the problem is no app can have keyboard focus as long as the screensaver is running/frontmost. So Xcode is not responding to keyboard events until I terminate the process. If you run without gdb, do you get a regular unexpectedly quit alert with the option to send a crash report (which includes a backtrace)? No. The process just hangs and I have to force a reboot. Have you tried running with malloc in scribbling/heap-checking mode, to see if anything funky's going on with the heap? ('man malloc' for details on the environment variables to set for this.) I'm not sure what to expect, but I did try just now to enable most of these settings and they didn't return anything that looked helpful in gdb. ___ 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: UITextField in UITableView covered by keyboard
On Oct 23, 2009, at 10:29 AM, Bob Barnes wrote: Hi all, I posted this a yesterday, but it never appeared on the list and it's not showing up in the web archive so I thought I'd retry. I have a UITableView that contains some cells with UITextField's embedded in them. When I touch the UITextField to begin editing the keyboard pops up and obscures the the text field. I've been looking at the UICatalog sample, which has a nearly identical setup and the UITextField scrolls up to make itself visible, but I've been unable to determine what it's doing to cause that. I've read suggestions on scrolling the UITexField rect, resizing the UITableView, etc., but UICatalog doesn't do any of that, yet still works. What am I missing? You may also have to consider the scenario where the Table View Cell that contains the UITextField is so close to the end of the Table View that it can not be scrolled up out of the way. In the case, you have to temporarily move the entire Table View upwards by adjusting its frame origin . . . Best Wishes, . . . . . . . .Henry ___ 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: UITextField in UITableView covered by keyboard
On Oct 24, 2009, at 4:31 PM, Henry McGilton (Boulevardier) wrote: On Oct 23, 2009, at 10:29 AM, Bob Barnes wrote: Hi all, I posted this a yesterday, but it never appeared on the list and it's not showing up in the web archive so I thought I'd retry. I have a UITableView that contains some cells with UITextField's embedded in them. When I touch the UITextField to begin editing the keyboard pops up and obscures the the text field. I've been looking at the UICatalog sample, which has a nearly identical setup and the UITextField scrolls up to make itself visible, but I've been unable to determine what it's doing to cause that. I've read suggestions on scrolling the UITexField rect, resizing the UITableView, etc., but UICatalog doesn't do any of that, yet still works. What am I missing? You may also have to consider the scenario where the Table View Cell that contains the UITextField is so close to the end of the Table View that it can not be scrolled up out of the way. In the case, you have to temporarily move the entire Table View upwards by adjusting its frame origin . . . Not at all - just set the content inset scroll bar inset appropriately (which is what UITableViewController does). Way more easy than messing with frames (not to mention works correct - moving the frame will result in the other end of the scrolling range not being reachable). Glenn Andreas gandr...@gandreas.com http://www.gandreas.com/ wicked fun! Mad, Bad, and Dangerous to Know ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: Crash drawing image
If you have extracted this to a test project, does that mean you now have a reproducing case whose source you can share? If so, why don't you put it up somewhere. You could also try doing a Build and Analyze in Xcode. It is possible to make memory management mistakes in gc, and the analyzer will catch a large class of them. On Saturday, October 24, 2009, slasktrattena...@gmail.com slasktrattena...@gmail.com wrote: Weird... It seems that sourceImage (the generic one only) is being garbage collected in the middle of the drawing. If I disable GC just before doing the drawing, and enable it again afterwards, the process stops crashing. I verified this by making a new project, where I placed the screensaver view in a normal window. With GC disabled, there were no crashes. As soon as I enabled GC, it started crashing. Backtrace says: #0 0x91c008c5 in ripc_RemoveEntry () #1 0x91bdd7b0 in ripc_AcquireImage () #2 0x91bdb3be in ripc_DrawImage () #3 0x937eab60 in CGContextDrawImage () #4 0x92c4d3c7 in __-[NSImageRep drawInRect:fromRect:operation:fraction:respectFlipped:hints:]_block_invoke_1 () #5 0x92c4ca4d in -[NSImageRep drawInRect:fromRect:operation:fraction:respectFlipped:hints:] () #6 0x92c4b586 in __-[NSImage drawInRect:fromRect:operation:fraction:respectFlipped:hints:]_block_invoke_1 () #7 0x92c48e1b in -[NSImage _usingBestRepresentationForRect:context:hints:body:] () #8 0x92c48950 in -[NSImage drawInRect:fromRect:operation:fraction:respectFlipped:hints:] () #9 0x92d06d9b in -[NSImage drawInRect:fromRect:operation:fraction:] () #10 0x92d335de in -[NSImage _composite:delta:fromRect:toPoint:] () #11 0x92d32af5 in -[NSImage compositeToPoint:fromRect:operation:] () #12 0x92d32a8d in -[NSImage compositeToPoint:operation:] () #13 0x2acd in +[NSImage(Reflection) appendReflectionToImage:fraction:] (self=0xa03195c0, _cmd=0x9324, sourceImage=0x1251440, fraction=0.5) at /Users/fabian/Lounge/Lounge/NSImage+Reflection.m:29 #14 0x47b0 in -[MainController updateTrackInfo:] (self=0x1026cc0, _cmd=0x908a, dict=0x123a260) at /Users/fabian/Lounge/Lounge/MainController.m:379 #15 0x94b41b65 in __NSFireDelayedPerform () #16 0x93fcbeee in __CFRunLoopRun () #17 0x93fc9d34 in CFRunLoopRunSpecific () #18 0x93fc9b61 in CFRunLoopRunInMode () #19 0x94dbafec in RunCurrentEventLoopInMode () #20 0x94dbada3 in ReceiveNextEventCommon () #21 0x94dbac28 in BlockUntilNextEventMatchingListInMode () #22 0x92c10b99 in _DPSNextEvent () #23 0x92c1040e in -[NSApplication nextEventMatchingMask:untilDate:inMode:dequeue:] () #24 0x92bd25fb in -[NSApplication run] () #25 0x92bca695 in NSApplicationMain () #26 0x2108 in main (argc=0x1, argv=0xb7d4) at /Users/fabian/Lounge/Lounge/main.m:13 On Sat, Oct 24, 2009 at 7:36 PM, slasktrattena...@gmail.com slasktrattena...@gmail.com wrote: Thanks for your reply. On Sat, Oct 24, 2009 at 6:03 PM, Jens Alfke j...@mooseyard.com wrote: It would be really good to get a backtrace. Are you launching the process with gdb, or at least attaching before the crash? Yes. I'm launching with gdb and pass the debug argument to Screen Saver Engine. This way the screen saver is running on the desktop window level. And after the crash, gdb is confused and can't get info about the process? Sort of. I think the problem is no app can have keyboard focus as long as the screensaver is running/frontmost. So Xcode is not responding to keyboard events until I terminate the process. If you run without gdb, do you get a regular unexpectedly quit alert with the option to send a crash report (which includes a backtrace)? No. The process just hangs and I have to force a reboot. Have you tried running with malloc in scribbling/heap-checking mode, to see if anything funky's going on with the heap? ('man malloc' for details on the environment variables to set for this.) I'm not sure what to expect, but I did try just now to enable most of these settings and they didn't return anything that looked helpful in gdb. ___ 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/kenferry%40gmail.com This email sent to kenfe...@gmail.com ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: UITextField in UITableView covered by keyboard
Glenn, So any thoughts why the UITableViewController isn't setting content inset appropriately in this case? I think it's because the view has a navigation bar and/or tab bar, but I haven't proven that yet. Bob On Oct 24, 2009, at 2:34 PM, glenn andreas wrote: On Oct 24, 2009, at 4:31 PM, Henry McGilton (Boulevardier) wrote: On Oct 23, 2009, at 10:29 AM, Bob Barnes wrote: Hi all, I posted this a yesterday, but it never appeared on the list and it's not showing up in the web archive so I thought I'd retry. I have a UITableView that contains some cells with UITextField's embedded in them. When I touch the UITextField to begin editing the keyboard pops up and obscures the the text field. I've been looking at the UICatalog sample, which has a nearly identical setup and the UITextField scrolls up to make itself visible, but I've been unable to determine what it's doing to cause that. I've read suggestions on scrolling the UITexField rect, resizing the UITableView, etc., but UICatalog doesn't do any of that, yet still works. What am I missing? You may also have to consider the scenario where the Table View Cell that contains the UITextField is so close to the end of the Table View that it can not be scrolled up out of the way. In the case, you have to temporarily move the entire Table View upwards by adjusting its frame origin . . . Not at all - just set the content inset scroll bar inset appropriately (which is what UITableViewController does). Way more easy than messing with frames (not to mention works correct - moving the frame will result in the other end of the scrolling range not being reachable). Glenn Andreas gandr...@gandreas.com http://www.gandreas.com/ wicked fun! Mad, Bad, and Dangerous to Know ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/toadfoot%40comcast.net This email sent to toadf...@comcast.net ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: Crash drawing image
On 24 Oct 2009, at 10:36, slasktrattena...@gmail.com wrote: And after the crash, gdb is confused and can't get info about the process? Sort of. I think the problem is no app can have keyboard focus as long as the screensaver is running/frontmost. So Xcode is not responding to keyboard events until I terminate the process. Try SSHing in from another machine and attaching to the process that way? ___ 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: Crash drawing image
On Sat, Oct 24, 2009 at 3:41 PM, Andrew Farmer andf...@gmail.com wrote: Try SSHing in from another machine and attaching to the process that way? If you want to do this from within Xcode: http://lists.apple.com/archives/xcode-users/2008/May/msg00226.html --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: IKImageBrowserView Dragging outside
Thanks again Thomas and Jonathan. What you've written, Thomas, is indeed working as it should however I can't use it for my project since I am creating special folder structures when copying the files, e.g. Adobe Photoshop Files - 2008-10-20 - MyPSFile.psd. Isn't there a way to get the folder dropped to and then do the copy operation myself? I am having an NSTableView that does pretty much the same thing, look: - (BOOL)tableView:(NSTableView *)tv writeRowsWithIndexes:(NSIndexSet *)rowIndexes toPasteboard:(NSPasteboard *)pboard { if (NSNotFound != [rowIndexes firstIndex]) { [array setSelectionIndexes:rowIndexes]; [pboard declareTypes:[self types] owner:self]; [pboard setPropertyList:[NSArray arrayWithObject:@ESPFilePromiseType] forType:NSFilesPromisePboardType]; } return YES; } - (NSArray *)tableView:(NSTableView *)tv namesOfPromisedFilesDroppedAtDestination:(NSURL *)dropDestination forDraggedRowsWithIndexes:(NSIndexSet *)rowIndexes { [self restoreManagedObjects:[array selectedObjects] withDestinationFolder:[dropDestination path]]; return nil; } Since the method 'tableView:namesOfPromisedFilesDroppedAtDestination: …' doesn't exist I am currently out of luck. Tobias. On Oct 23, 2009, at 10:24 PM, jonat...@mugginsoft.com wrote: Tobias Not sure if this will help. In the example GoodThing is a core data subclass which stores the image as NSData. As such it implements the IKImageBrowserItem informal protocol methods -imageRepresentation, -imageRepresentationType (== IKImageBrowserNSDataRepresentationType) and - imageUID; /* write images to paste board need for dragging of non path represented images */ - (NSUInteger) imageBrowser:(IKImageBrowserView *) aBrowser writeItemsAtIndexes:(NSIndexSet *) itemIndexes toPasteboard: (NSPasteboard *)pasteboard { NSInteger index; NSInteger itemsWritten = 0; for (index = [itemIndexes lastIndex]; index != NSNotFound; index = [itemIndexes indexLessThanIndex:index]) { // get image data. GoodThing *goodThing = [imageBrowser itemAtIndex:index]; NSData *imageData = goodThing.imageRepresentation; // get a tiff representation and write to pasteboard NSImage *image = [[NSImage alloc] initWithData:imageData]; if (image) { NSData *tiffData = [image TIFFRepresentation]; // may raise an exception if (tiffData) { // prepare the pasteboard if (itemsWritten == 0) { [pasteboard declareTypes:[NSArray arrayWithObject:NSTIFFPboardType] owner:nil]; } // write to the pasteboard [pasteboard setData:tiffData forType:NSTIFFPboardType]; itemsWritten++; } } } return itemsWritten; } Regards Jonathan Mitchell Developer http://www.mugginsoft.com On Oct 23, 2009, at 11:44 PM, Thomas Goossens wrote: On Oct 23, 2009, at 9:15 PM, TFS - Tobias Jordan wrote: Thanks for that, Thomas. The Problem I'm having is that the IKImageBrowserView is just representing previews. So it's a file preview and there's a path behind the preview to be copied when dragging out. With the standard settings of the view, I'll get the preview image copied to the location instead of the file behind the image. That's why I have to implement everything on my own, I know this sounds confusing. ;-) ok that makes sense. I dunno know what to declare in the pasteboard when it is about NSIndexSets. And what to do next after implementing writeItemsAtIndexes:toPasteboard:…? Thanks so much for your help, I really appreciate it. This is not something specific to the IKImageBrowserView here so the pasteboard programming guide should help: http://developer.apple.com/mac/library/documentation/Cocoa/Conceptual/PasteboardGuide106/Introduction/Introduction.html Typically you will have to do something like this: - (NSUInteger) imageBrowser:(IKImageBrowserView *) aBrowser writeItemsAtIndexes:(NSIndexSet *) itemIndexes toPasteboard: (NSPasteboard *)pasteboard { NSUinteger index; //instantiate an array to store paths filesArray = [NSMutableArray array]; //for each index... for(index = [itemIndexes firstIndex]; index != NSNotFound; index = [itemIndexes indexGreaterThanIndex:index]){ //...get the path you want to add to the pasteboard id
Nested Views in different *.XIB files
Hi All, My goal is to have a split view with a left side pane containing an outline view - and 3 panes on the right on top of each other. To do this I did the following: 1) created a split view that is split horizontally into 3 parts. 2) I then created another split view that is split vertically into 2 parts - and put the split view created in step 1 in the right pane. The left pane has an NSOutlineView. In one of the split view panes I put a NSTabView - and inside that NSTabView I wish to put a form with labels, text boxes, etc. that is also scrollable. I would also like to have the view with the form elements defined in a separate *.xib (PatientsDemoForm.xib) file from the main *.xib (MainMenu.xib). I was able to set the content view of one of the NSTabViewItems to be the view that's defined in the other *.xib - but I am having trouble embedding that view in an NSScrollView. When it's *.xib file open and I have the view selected all the options under Layout-Embed Objects In are disabled. I started looking at doing it programatically. I was wondering if anyone could tell me if this is the best way to go about it - or if there is a better way? //Get the view from the View controller NSView * v = [patientDemoVC view]; //Create a clibView NSClipView * clipView = [[NSClipView alloc] init]; //Attach the view (i.e. the one that contains the form mentioned above) to the clibView [clipView setDocumentView:v]; //Create a scrollView NSScrollView* scrollView = [[NSScrollView alloc] init]; //Attach the clibView to the scrollView [scrollView setContentView:clipView]; //Set the scrollView as the content view of the tabview item. NSTabViewItem * tvi = [[NSTabViewItem alloc] init]; [tvi setView:scrollView ]; I know that there is still some things I need to do in order to get this to work - but I really would like to find out if I am going about it the right way - or if I am barking up the wrong tree.. Thanks for your help! Mazen Abdel-Rahman ___ 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: Nested Views in different *.XIB files
On 25/10/2009, at 4:02 PM, Mazen M. Abdel-Rahman wrote: I was wondering if anyone could tell me if this is the best way to go about it - or if there is a better way? Yes. Just don't put everything into separate nibs. Why do it if it makes life harder? Usually everything that ends up in the same window should come from the same nib - there's no advantage to separating it into separate nibs as the whole window will need to be built to be useful. Using separate nibs will be slower, take more memory and make life very hard for you stitching all the bits together. Instead, use one nib and hook up everything in that one place. --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