Re: How to parse multipart/form-data?

2012-01-29 Thread Thomas Davie
CoreParse!

https://github.com/beelsebob/CoreParse

I hope that helps :)

Thanks

Tom Davie
if (*ra4 != 0xffc78948) { return false; }

On 28 Jan 2012, at 06:29, Kai Cao wrote:

 Hi,
 
 I'm using CocoaHTTPServer to upload files from computer to iOS devices. But 
 the result NSData received from the browser is multipart form data, which is 
 really hard to parse manually. I know I can write a parser from scratch, 
 however, it's time consuming and bug prone. I'm wondering wether there's a 
 sophisticated library/framework for this. Any help would be appreciated. 
 Thanks in advance. 
 
 Best regards,
 
 Kai
 nonamel...@me.com
 
 sent from Mobile Me
 ___
 
 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:
 https://lists.apple.com/mailman/options/cocoa-dev/tom.davie%40gmail.com
 
 This email sent to tom.da...@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:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Use of Application nib file template

2012-01-29 Thread Rick Mann
One of the file templates for iOS UI is Application, described as, An 
Interface Builder document suitable for creating an iOS application, including 
an application delegate and window.

Problem is, I don't see how to use it. I tried making it the main nib file (via 
info.plist), but my app throws an exception in UIApplicationMain(), without 
logging any information indicating what's wrong.

In the past, I've had nib files for the main window (main nib via Info.plist), 
and the file's owner is the application, indicating it's already created.

How am I intended to use the Application NIB file?

Thanks,
Rick


___

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:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Re: Use of Application nib file template

2012-01-29 Thread Rick Mann
Okay, slight misunderstanding about how this file is supposed to work. I got it 
in my head that it actually instantiated the UIApplication object. I realize 
now that it does not.

Now I just have to figure out why an exception is being thrown. I'm sure it's 
some sort of name mismatch with Info.plist.

-- 
Rick

On Jan 29, 2012, at 3:08 , Rick Mann wrote:

 One of the file templates for iOS UI is Application, described as, An 
 Interface Builder document suitable for creating an iOS application, 
 including an application delegate and window.
 
 Problem is, I don't see how to use it. I tried making it the main nib file 
 (via info.plist), but my app throws an exception in UIApplicationMain(), 
 without logging any information indicating what's wrong.
 
 In the past, I've had nib files for the main window (main nib via 
 Info.plist), and the file's owner is the application, indicating it's already 
 created.
 
 How am I intended to use the Application NIB file?
 
 Thanks,
 Rick
 
 
 ___
 
 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:
 https://lists.apple.com/mailman/options/cocoa-dev/rmann%40latencyzero.com
 
 This email sent to rm...@latencyzero.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:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Re: Use of Application nib file template

2012-01-29 Thread Rick Mann
Figured it out. Some of the objects in my new nib weren't properly set up.

In this day and age of Xcode 4 and iOS 5, I'm really disappointed that the NIB 
loading still doesn't report errors very well.

-- 
Rick

On Jan 29, 2012, at 3:29 , Rick Mann wrote:

 Okay, slight misunderstanding about how this file is supposed to work. I got 
 it in my head that it actually instantiated the UIApplication object. I 
 realize now that it does not.
 
 Now I just have to figure out why an exception is being thrown. I'm sure it's 
 some sort of name mismatch with Info.plist.
 
 -- 
 Rick
 
 On Jan 29, 2012, at 3:08 , Rick Mann wrote:
 
 One of the file templates for iOS UI is Application, described as, An 
 Interface Builder document suitable for creating an iOS application, 
 including an application delegate and window.
 
 Problem is, I don't see how to use it. I tried making it the main nib file 
 (via info.plist), but my app throws an exception in UIApplicationMain(), 
 without logging any information indicating what's wrong.
 
 In the past, I've had nib files for the main window (main nib via 
 Info.plist), and the file's owner is the application, indicating it's 
 already created.
 
 How am I intended to use the Application NIB file?
 
 Thanks,
 Rick
 
 
 ___
 
 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:
 https://lists.apple.com/mailman/options/cocoa-dev/rmann%40latencyzero.com
 
 This email sent to rm...@latencyzero.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:
 https://lists.apple.com/mailman/options/cocoa-dev/rmann%40latencyzero.com
 
 This email sent to rm...@latencyzero.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:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Subclassing IKImageView

2012-01-29 Thread Jan E. Schotsman

Hello,

I want to modify IKImageView so that it erases with the window  
background color. By default it erases with medium gray which looks  
awful.


I tried implementing -drawRect but this is only called when the window  
opens. It isn't even called when the image is set to nil.

Can one set the erase color of an NSView?

Also I want to register the file url when the user drags an image file  
on the view. How do I go about that?

Can I make it accept image files but not images in general?

TIA,

Jan E.

___

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:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Re: getting a nsurl file size

2012-01-29 Thread Eric Smith
The getResource... method returns YES whether I pass @content-length or 
NSURLFileSize (I tried that one first).

Eric


On Jan 28, 2012, at 10:21 PM, Ken Thomases wrote:

 On Jan 28, 2012, at 11:53 PM, Eric Smith wrote:
 
 I'm trying to determine the size of a file on a server.  If I send the 
 following message to an NSURL named path, I get:
 
 [path getResourceValue:value forKey:@content-length error:error];
 
 value comes back nil.
 
 Two things:
 
 * Did the method return TRUE or FALSE?  If FALSE, what error did you get back?
 
 * The keys that are valid for that method are those listed in the NSURL 
 documentation.  They may bear no relation to HTTP response header fields.  
 So, I see no reason to believe that content-length is a valid key.  Have 
 you tried NSURLFileSizeKey?
 
 
 If I send:
 
 value = [path propertyForKey:@content-length];
 
 which is deprecated, I get the correct file size.
 
 That may be fluke.
 
 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:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Re: getting a nsurl file size

2012-01-29 Thread Eric Smith
Charles,

Works like a charm.  Thank you!

Eric


On Jan 28, 2012, at 11:28 PM, Charles Srstka wrote:

 On Jan 29, 2012, at 12:21 AM, Ken Thomases wrote:
 
 * The keys that are valid for that method are those listed in the NSURL 
 documentation.  They may bear no relation to HTTP response header fields.  
 So, I see no reason to believe that content-length is a valid key.  Have 
 you tried NSURLFileSizeKey?
 
 
 If I send:
 
 value = [path propertyForKey:@content-length];
 
 which is deprecated, I get the correct file size.
 
 That may be fluke.
 
 NSURL’s now deprecated -propertyForKey: method existed long before any of 
 those NSURL*Key constants did, so it’s difficult to imagine what could have 
 been passed to it other than HTTP response header field names.
 
 At any rate, this should do what you want:
 
 NSMutableURLRequest *req = [NSMutableURLRequest requestWithURL:url];
 
 req.HTTPMethod = @HEAD;
 [req setValue:@ forHTTPHeaderField:@Accept-Encoding];
 
 void (^completionBlock)(NSURLResponse *resp, NSData *data, NSError *error) = 
 ^(NSURLResponse *resp, NSData *data, NSError *error) {
 if([resp isKindOfClass:[NSHTTPURLResponse class]]) {
 NSLog(@length is %@, [((NSHTTPURLResponse *)resp).allHeaderFields 
 objectForKey:@Content-Length]);
 }
 };
 
 [NSURLConnection sendAsynchronousRequest:req queue:[NSOperationQueue 
 mainQueue] completionHandler:completionBlock];
 
 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:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Re: Use of Application nib file template

2012-01-29 Thread Kyle Sluder
On Jan 29, 2012, at 3:55 AM, Rick Mann rm...@latencyzero.com wrote:

 Figured it out. Some of the objects in my new nib weren't properly set up.
 
 In this day and age of Xcode 4 and iOS 5, I'm really disappointed that the 
 NIB loading still doesn't report errors very well.

When it threw an exception, did you break in the debugger? By default, Xcode 
breaks on objc_exception_throw. Obviously you will need to hit Continue if you 
want to see any log output. Or you could just print the first argument; consult 
your local ABI documentation for more info.

--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:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Re: Is NSRuleEditor worth the learning curve?

2012-01-29 Thread Fritz Anderson
On 28 Jan 2012, at 6:23 PM, Erik Stainsby wrote:

 One example I have found (NibBasedSpotlightSearcher.xcodeproj - circa 2006) 
 presents a window in the nib which holds clusters of related controls in a 
 single view. I'm doing the gasping guppy trying to see where in the code 
 those individual controls are addressed, loaded and applied. 

I can't help you with your general question — the Google results are very 
sparse, aren't they? — but I'm pretty sure you can ignore that window with all 
the popups and fields.

The only reference I can find to the project you mention relates to it as an 
example of localization, not of rule editing itself. It's hosted on 
homepage.mac.com, which suggests it's an orphan. I think it represents the 
author's explorations at a particular moment in time, and not a finished 
example.

The meat of that project lies in the NSRuleEditorDelegate methods.

— 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:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Re: Subclassing IKImageView

2012-01-29 Thread Fritz Anderson
On 29 Jan 2012, at 8:42 AM, Jan E. Schotsman wrote:

 I want to modify IKImageView so that it erases with the window background 
 color. By default it erases with medium gray which looks awful.
 
 I tried implementing -drawRect but this is only called when the window opens. 
 It isn't even called when the image is set to nil.
 Can one set the erase color of an NSView?

I'm curious — how does the instance property .backgroundColor not suit your 
purpose?

 Also I want to register the file url when the user drags an image file on the 
 view. How do I go about that?
 Can I make it accept image files but not images in general?

I'd experiment with subclassing, then overriding the setImageWithURL: and 
setImage:imageProperties: methods. Possibly those aren't on the pipeline for 
drag-and-drop. In that case, my next experiment would be to override the 
NSDraggingDestination methods.

— 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:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Re: Drag and drop in collectionview

2012-01-29 Thread Gordon Apple
 If you are just trying to rearrange things in your list, you do not need to
 get involved with the pasteboard.  Rearranging arrays (or ordered sets) is a
 little tricky, especially if you want to drag a dispersed collection to a
 specific location which is in or after the extent of the selection.  You have
 to figure out how first removing the objects affects your insertion index,
 then insert them back in at the modified row index.  Note that if you are
 using table bindings, you want to operate on the original array which your
 array controller manages, then let the bindings update the table.
 
 I just did this (in a viewController) last night for an NSOrderedSet using the
 following:
 
 - (void) moveSelectedObjectsToRow:(NSUInteger)row {
 NSIndexSet *indexes = [(NSArrayController*)self.representedObject
 selectionIndexes];
 NSRange rangeAbove = NSMakeRange(0, row);   //  Range of all objects above
 row in table.
 NSUInteger numAbove = [indexes countOfIndexesInRange:rangeAbove];  //  Num
 selected above row in table.
 NSUInteger newRow = row - numAbove;  //  Where we move selection to.
 [self.parentBase moveSublistObjectsAtIndexes:indexes toIndex:newRow];   //
 Replace this for Arrays.
 }
 
 
 Using an array instead of an orderedSet, the last line will be different.  At
 that point, you need to move the selected objects from the array into a temp
 array, then reinsert at ³newRow².  None of this involves the pasteboard.
 
 I wish they would include a method to do this, but even the ³move² method in
 NSMutableOrderedSet does not do what is typically wanted, at least without
 doing the above yourself.
 
 Follow up : Reading some more, I've found that I could just use a custom
 representation for my objects, containing their index in the model array, to
 write to the pasteboard, and then use that index to perform to move when the
 dragging session is accepted. On 28 Jan 2012, at 13:35, Luc Van Bogaert
 wrote:   I'm implementing drag and drop for a NSCollectionView. The idea is
 to rearrange objects in the collection by dragging them to another location.
 Having read the docs for NSCollectionViewDelegate and NSPasteboard, I still
 have a few general questions about the concept. 

___

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:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

NSLayoutManager's setDefaultAttachmentScaling: not working in custom PDF NSContexts.

2012-01-29 Thread Gus Mueller
I have an issue where using NSLayoutManager's 
setDefaultAttachmentScaling:NSImageScaleProportionallyDown doesn't seem to work 
if I setup my own NSGraphicsContext + CGPDFContext.

The problem is that large inline images are not scaled down when drawn like 
they would be in an NSTextView.  Text after the image is positioned as if it 
was scaled though, so I end up with text that is drawn over an image.

Here's the abbreviated code for what I'm doing:

.. make a CGPDFContext ctx, wrap it up in a flipped NSGraphicsContext
.. load an NSTextStorage contents up with my RTFD file

NSLayoutManager *layoutManager = [[[NSLayoutManager alloc] init] autorelease];
[contents addLayoutManager:layoutManager];

[layoutManager setDefaultAttachmentScaling:NSImageScaleProportionallyDown];

BOOL clipped = NO;
do {
CGContextBeginPage(ctx, box);
CGContextTranslateCTM( ctx, 0, box.size.height);
CGContextScaleCTM(ctx, 1.0, -1.0 );

NSTextContainer *textContainer = [[[NSTextContainer alloc] 
initWithContainerSize:box.size] autorelease];
[layoutManager addTextContainer:textContainer];
[layoutManager ensureLayoutForTextContainer:textContainer];

NSRange glyphRange = [layoutManager 
glyphRangeForTextContainer:textContainer];
NSRange charRange  = [layoutManager characterRangeForGlyphRange:glyphRange 
actualGlyphRange:nil];

[layoutManager drawGlyphsForGlyphRange:glyphRange atPoint:NSZeroPoint];

clipped = (NSMaxRange(charRange)  [contents length]);

CGContextEndPage(ctx);
}
while (clipped);

.. cleanup

I've got some very simple sample code which reproduces the behavior here:
http://gusmueller.com/stuff/NSLayoutImageScalingPDFProblem.zip

Can anyone shed some light on what I'm doing wrong?
This is on 10.7.2 btw.

thanks,

-gus

--  

August 'Gus' Mueller
Flying Meat Inc.
http://flyingmeat.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:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Re: Use of Application nib file template

2012-01-29 Thread Ben Kennedy
On 29 Jan 2012, at 8:54 am, Kyle Sluder wrote:

 When it threw an exception, did you break in the debugger? By default, Xcode 
 breaks on objc_exception_throw. Obviously you will need to hit Continue if 
 you want to see any log output. Or you could just print the first argument; 
 consult your local ABI documentation for more info.

Why doesn't Xcode do this automatically?  Infuriating.

b


--
Ben Kennedy, chief magician
Zygoat Creative Technical Services
http://www.zygoat.ca


___

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:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Sensitivity of swipe gesture

2012-01-29 Thread James Merkel
Somewhat off-topic for Cocoa -- but In Lion 10.7,  the swipe gesture is a nice 
feature of the  mouse. However I find that frequently the mouse wants to swipe 
pages when I just want to scroll the page.
When that happens the page has to settle down before anything else can be 
done. Kind of annoying.
Is there any sensitivity preference or whatever for the swipe gesture?
Then again maybe I'm just lacking motor control in my old age!

Jim Merkel



___

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:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Re: Subclassing IKImageView

2012-01-29 Thread Jan E. Schotsman


On Jan 29, 2012, at 6:27 PM, Fritz Anderson wrote:

I want to modify IKImageView so that it erases with the window  
background color. By default it erases with medium gray which looks  
awful.


I'm curious — how does the instance property .backgroundColor not  
suit your purpose?


Me I am curious why a search in the Organizer didn't turn it up - only  
for UIView.


[self setBackgroundColor:[[self window] backgroundColor]] in - 
awakeFromNib does the job.
(in Carbon the window's backgroundColor didn't do it - I had to use  
the theme brush color)


Problem solved, except I still have to implement -drawRect or else the  
empty view is still erased with medium grey when the window opens.  
Calling -setNeedsDisplay in -awakeFromNib (after -setBackgroundColor)  
didn't help.


Also I want to register the file url when the user drags an image  
file on the view. How do I go about that?

Can I make it accept image files but not images in general?


I'd experiment with subclassing, then overriding the  
setImageWithURL: and setImage:imageProperties: methods. Possibly  
those aren't on the pipeline for drag-and-drop. In that case, my  
next experiment would be to override the NSDraggingDestination  
methods.


Neither -setImage:imageProperties: nor -setImageWithURL: is called  
after a drag.


Jan E.


___

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:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Re: Use of Application nib file template

2012-01-29 Thread Rick Mann
Yep, I hit continue. It just jumps to __kill without logging.

Printing the first argument might work, I'll try that next time. 

Sent from my iPhone

On Jan 29, 2012, at 8:54, Kyle Sluder kyle.slu...@gmail.com wrote:

 On Jan 29, 2012, at 3:55 AM, Rick Mann rm...@latencyzero.com wrote:
 
 Figured it out. Some of the objects in my new nib weren't properly set up.
 
 In this day and age of Xcode 4 and iOS 5, I'm really disappointed that the 
 NIB loading still doesn't report errors very well.
 
 When it threw an exception, did you break in the debugger? By default, Xcode 
 breaks on objc_exception_throw. Obviously you will need to hit Continue if 
 you want to see any log output. Or you could just print the first argument; 
 consult your local ABI documentation for more info.
 
 --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:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Re: Use of Application nib file template

2012-01-29 Thread Kyle Sluder
On Sun, Jan 29, 2012 at 11:12 AM, Ben Kennedy b...@zygoat.ca wrote:
 On 29 Jan 2012, at 8:54 am, Kyle Sluder wrote:

 When it threw an exception, did you break in the debugger? By default, Xcode 
 breaks on objc_exception_throw. Obviously you will need to hit Continue if 
 you want to see any log output. Or you could just print the first argument; 
 consult your local ABI documentation for more info.

 Why doesn't Xcode do this automatically?  Infuriating.

Do what, start calling Objective-C runtime functions in my program
without my consent?

--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:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Re: Use of Application nib file template

2012-01-29 Thread Ben Kennedy
On 29 Jan 2012, at 2:23 pm, Kyle Sluder wrote:

 Or you could just print the first argument; consult your local ABI 
 documentation for more info.
 
 Why doesn't Xcode do this automatically?  Infuriating.
 
 Do what, start calling Objective-C runtime functions in my program
 without my consent?

Like -[theDamnExceptionBeingThrown description] ?  I suppose you have a point.  
But in a case like this, I'd be quite happy for Xcode to make that indulgence.  
As it stands, it is obtuse to put the onus on the user to figure out what 
register contains the exception (à propos to the current ABI) and then issue 
the call oneself.  Wouldn't it make more sense for Xcode to offer a print the 
exception checkbox in the breakpoint inspector?

I suppose I should file a bug against this (if I haven't already; I can't 
remember.)

b

--
Ben Kennedy, chief magician
Zygoat Creative Technical Services
http://www.zygoat.ca


___

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:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Re: How to parse multipart/form-data?

2012-01-29 Thread Jens Alfke

On Jan 27, 2012, at 10:29 PM, Kai Cao wrote:

 I'm using CocoaHTTPServer to upload files from computer to iOS devices. But 
 the result NSData received from the browser is multipart form data, which is 
 really hard to parse manually. I know I can write a parser from scratch, 
 however, it's time consuming and bug prone. I'm wondering wether there's a 
 sophisticated library/framework for this. Any help would be appreciated. 
 Thanks in advance. 

Google’s GTMHTTPFetcher library has some MIME multipart support, but it might 
only support generating, not parsing:

http://code.google.com/p/gtm-http-fetcher/wiki/GTMHTTPFetcherIntroduction#Uploading_Multipart_MIME_Documents

—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:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

How do you run an app on the device with Instruments?

2012-01-29 Thread G S
Hi all.

After finding an alleged answer on the Web (since the Apple
documentation refers to the nonexistent Run  Start with Performance
Tool menu in Xcode), I still can't get my app running in Instruments.
Choosing Profile from the Product menu does cause Instruments to
prompt for a template, but after I choose one (Leaks, for the device)
Instruments just sits there and the Xcode LCD says Finished running
- Profiling.  The Record button is disabled.  Running in Xcode
doesn't change anything either.

What gives?

Thanks for any insight.

Gavin
___

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:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


NSTextFieldCell not getting disabled

2012-01-29 Thread Abhijeet Singh
Hi,I have used NSComboBoxCell in my NSTableView to show the list of items. Once 
user done with its selection and moved to next TableView row I replace 
NSComboBoxCell with non editable NSTextFieldCell in previous row using (NSCell 
*)tableView:(NSTableView *)tableView dataCellForTableColumn:(NSTableColumn 
*)tableColumn row:(NSInteger)row method.This works fine only problem is when I 
disable the NSTableView all the NSTextFieldCells that I inserted remains 
enabled. I tried to disable NSTextFieldCell using setEnabled method but it 
doesn't work. Please suggest some solutionRegardsAbhijeetGet Yourself a 
cool, short @in.com Email ID now!
___

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:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


iCloud On OSX - Cannot save changes

2012-01-29 Thread April
On iOS iCloud is easy.
On OSX I don't know what the problem is.

Ok.. First I had a document on my computer. The using the setUbiquidous method 
I moved it to iCloud.
It is on iCloud, and readable. But thats the problem. I have read only access 
to it from the Mac App.

When I open the document I use : 

self.document = [[NTPDocument alloc]initWithContentsOfURL:iCloudURL 
ofType:@MyDataType error:err];

NTPDocument is my subclass of NSDocument. and only implements the dataOfType 
and readFromData. It also returns YES for autosaves in place.

And that's hitch #1.

When It attempts to autosave I get an error window in the app that it could not 
auto save the document because I do not have permission.

When I try the saveToURL:ofType:forSaveOperation:completionHandler:   I get an 
Unimplemented core routine error (code -4) I have absolutely no clue what 
this means and cannot for the life of me find the information in the 
documentation on how to open the file for read/write access. I cannot find a 
flag or entitlement anywhere that I am missing for allowing me to write to the 
icloud document...

I have attempted to just use [self.document saveDocument:nil] out of 
desperation but nothing saves, and no error.

The main thing being that no matter what way I try to save, my document is 
never asked to encode the document data.

I'm at a loss... Is there possibly an example of working code? Or some part of 
the documentation that I've not found? I foolishly thought this would be a 
simple matter of porting my iOS code...

If some one has gotten iCloud working for them could you please help?

April.
___

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:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


NSPopUpButton Binding Frustration

2012-01-29 Thread Seth Willits

This is such a dead simple problem that I think I've encountered a couple times 
over the years and I don't think I've managed to ever find a solution that 
works how I want. I'll break this down into an easy specific example.


Say I have a file type popup in a save sheet for saving an image:


@property NSString * fileType;


- (NSArray *)fileTypes
{
return [NSArray arrayWithObjects:(id)kUTTypeJPEG, (id)kUTTypePNG, 
(id)kUTTypeTIFF, nil];
}


- (NSArray *)fileTypeNames
{
return [NSArray arrayWithObjects:@JPEG, @PNG, @TIFF, nil];
}




The popup should display the names, but I want the selected item bound to 
fileType which is one of the UTIs. By my reading of the documentation, this 
_should be very simple_.

Bind:
content - fileTypes*
contentValues - fileTypeNames
selectedObject - fileType


So content provides the list of objects, contentValues provides the 
corresponding titles for each object, selectedObject determines which object is 
selected. Sounds simple, never works. I've never been able to figure it out. It 
seems that if contents provides an array of *strings*, those strings are use as 
the titles *no matter what*.

The documentation for content says: Unless contentValues is also bound, the 
titles of the items in the NSPopUpButton are derived by invoking description 
for each of the content objects, the documentation for contentValues says An 
array of strings that are displayed as the items in the NSPopUpButton,  but no 
matter what on earth I try, it will not work. If I have content bound to, say, 
an array of dictionaries, the popup uses contentValues to display the titles.


So what gives? This should be dead simple and for the life of me I can't figure 
it out. 

Thanks.



*(The docs say content should be bound to an array controller — Not sure why 
it says that. An array appears to work the same as an array controller when I 
try it. I've tried creating an array controller bound to fileTypes and binding 
the popup's content to the ac.arrangedObjects but it still doesn't change the 
title situation.)


--
Seth Willits




___

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:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Re: NSPopUpButton Binding Frustration

2012-01-29 Thread Quincey Morris
On Jan 29, 2012, at 22:32 , Seth Willits wrote:

 The popup should display the names, but I want the selected item bound to 
 fileType which is one of the UTIs. By my reading of the documentation, this 
 _should be very simple_.
 
 Bind:
 content - fileTypes*
 contentValues - fileTypeNames
 selectedObject - fileType
 
 
 So content provides the list of objects, contentValues provides the 
 corresponding titles for each object, selectedObject determines which object 
 is selected. Sounds simple, never works. I've never been able to figure it 
 out. It seems that if contents provides an array of *strings*, those strings 
 are use as the titles *no matter what*.
 
 The documentation for content says: Unless contentValues is also bound, the 
 titles of the items in the NSPopUpButton are derived by invoking description 
 for each of the content objects, the documentation for contentValues says 
 An array of strings that are displayed as the items in the NSPopUpButton,  
 but no matter what on earth I try, it will not work. If I have content bound 
 to, say, an array of dictionaries, the popup uses contentValues to display 
 the titles.

I dunno, but I think the bindings should be like this:

content - fileTypeNames
contentObjects - fileTypes
selectedObject - fileType

The issue of 'content' providing titles instead of 'contentValue' if it 
contains strings -- that sounds like a bug, or one of those bug-like design 
decisions.

If the documentation says 'content' should be an array controller, I'd be 
inclined to do it, but who can tell. If you just want to bind to an an array, 
you can bind to contentValues instead, and leave 'content' unbound (but in that 
case you don't get to bind 'contentObjects').


___

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:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com