Re: Pass-by value… warning

2010-07-07 Thread vincent habchi
Le 7 juil. 2010 à 08:54, Greg Guerin a écrit :

> vincent habchi wrote:
> 
>> The analyzer does not figure out that the pt array gets initialized through 
>> the loop by copying values directly from a chunk of memory, and spits out 
>> the warning about pt [•] not being defined. Maybe I should report this to 
>> the LLVM team?
> 
> 
> That seems like a good idea.
> 
> However, also consider that 'dim' may take on values 0 or 1.  If dim is 0 or 
> 1, then the local 'pt' array may not have valid elements at pt[0] or pt[1].  
> You may know that dim is never 0 or 1, but the analyzer has no way of knowing 
> that.
> 
> And I don't know what might happen if dim is negative.

That's true, the compiler cannot guarantee that dim > 1, which is always the 
case actually.
I am going to put an extra text at the beginning of the method, like: "if (dim 
< 1) return;" and see what happens.

Vincent

___

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: Pass-by value… warning

2010-07-07 Thread vincent habchi
Le 7 juil. 2010 à 09:23, vincent habchi a écrit :

> That's true, the compiler cannot guarantee that dim > 1, which is always the 
> case actually.
> I am going to put an extra text at the beginning of the method, like: "if 
> (dim < 1) return;" and see what happens.

The warning goes away when I do that. Nice! Finally, I think it's not a bug, 
but rather a great feature. I am surprised by the degree of wisdom the LLVM 
team put into this analyzer. It's really a great tool.

Vincent___

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: Pass-by value… warning (was: NSText Field fieldeditor subclass example? (and an unrelate d other inquiry))

2010-07-07 Thread Graham Cox

On 07/07/2010, at 3:59 PM, vincent habchi wrote:

> - (void)drawPoint:(CGContextRef)ctx origin:(CGPoint)origin dimension:(int)dim 
> data:(double **)data {
>   double pt [dim];
>   
>   for (int i = 0 ; i < dim ; i ++, *data ++) {
>   memcpy (& (pt [i]), * data, sizeof (double));
>   }


I have to ask - why are you doing a copy here, and in such an inefficient way 
too? Your data already is an array of doubles, why do you need to convert to 
another one? Also, why the double indirection?

You may find that doing things conventionally will not only keep the compiler 
from whining, but boost performance too. Win-win!

Curious, Graham


___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

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


Re: Pass-by value… warning (was: NSText Field fieldeditor subclass example? (and an unrelate d other inquiry))

2010-07-07 Thread vincent habchi
Le 7 juil. 2010 à 09:33, Graham Cox a écrit :

> 
> On 07/07/2010, at 3:59 PM, vincent habchi wrote:
> 
>> - (void)drawPoint:(CGContextRef)ctx origin:(CGPoint)origin 
>> dimension:(int)dim data:(double **)data {
>>  double pt [dim];
>>  
>>  for (int i = 0 ; i < dim ; i ++, *data ++) {
>>  memcpy (& (pt [i]), * data, sizeof (double));
>>  }
> 
> 
> I have to ask - why are you doing a copy here, and in such an inefficient way 
> too? Your data already is an array of doubles, why do you need to convert to 
> another one? Also, why the double indirection?

The double indirection is necessary in order for the master data pointer 
(*data) to progress through the data chunk; since that chunk can hold different 
items, I have to decode it on the fly and call the appropriate method that 
interprets an appropriate block of data. If I were using a '(double *)data' 
instead, I would end up incrementing a local copy, and the main pointer in the 
caller method would not be altered. Or am I mistaken?

But, basically you're right about the copy. This might be more canonical:

[foo point:NSMakePoint (* data, * (data + 1))];
* data += dim;

Thanks for pointing me out this, as always, your comments are *really* helpful

Vincent___

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: Accessing address bar data from Safari extension

2010-07-07 Thread cocoa learner
I am sorry.


On Tue, Jul 6, 2010 at 7:08 PM, John Joyce  wrote:

>
> On Jul 6, 2010, at 6:21 AM, cocoa learner wrote:
>
> > Hi All,
> >
> > Can we access address bar text box and bookmark data from Safari
> extension?
> > If yes, please share some thoughts or APIs.
> >
> > --
> > Thanks
> > Cocoa.learner
> > http://rajeshmaclabs.com/
> > ___
> This is not actually a Cocoa question.
> Please take it to the Safari/Webkit lists or the Safari Developer forum.
> Thanks,
> John
>



-- 
Thanks
Cocoa.learner
http://rajeshmaclabs.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: Scrolling not working ...

2010-07-07 Thread vincent habchi
Le 7 juil. 2010 à 08:42, Jay Reynolds Freeman a écrit :

> I have has reasonable values.  The actual code is based on the
> example for program-controlled scrolling in the documentation, and
> goes like this:
> 
>  NSPoint scrollerOrigin = [[ contentView] bounds].origin;
> 
> Then, later:
> 
>  [[ documentView] scrollPoint:scrollerOrigin];
> 
> And no scrolling takes place.

Did you try:
[[ documentView] scrollPoint:NSMakePoint(0, 0)]; ?

Vincent

___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

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


Custom control and cells

2010-07-07 Thread Georg Seifert
Hi,

I try to find an example on how to implement the mouse tracking and editing 
behavior of a NSCell from my own control (subclass of NSControl). I need a 
control that can handle several kinds of cells like ImageAndTextCell (with 
editing) or popup button cells.

I read a lot about it but can’t fit it together.

Does anyone have some sample code or explanation.

Best
Georg___

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: Pass-by value… warning (was: NSText Field fieldeditor subclass example? (and an unrelate d other inquiry))

2010-07-07 Thread Graham Cox

On 07/07/2010, at 5:51 PM, vincent habchi wrote:

> The double indirection is necessary in order for the master data pointer 
> (*data) to progress through the data chunk; since that chunk can hold 
> different items, I have to decode it on the fly and call the appropriate 
> method that interprets an appropriate block of data. If I were using a 
> '(double *)data' instead, I would end up incrementing a local copy, and the 
> main pointer in the caller method would not be altered. Or am I mistaken?

OK, so the idea is to leave the pointer you're given incremented past the chunk 
of data it parsed.

I guess it's question of style. To me this seems like one part of the code (the 
caller) is praying and hoping that another part it calls does the right thing 
as a side-effect of its true function, instead of just telling it what to do. 
If you know in advance how many items to process, there's no reason to do it 
that way.

I think what I'd do is tell the called function how many items to process. Then 
whether it does or not, the caller is able to increment the pointer itself by 
the appropriate amount, since it knows the data size.

e.g.

caller:

char*   ptrToCurrentData;

// assume the above points to some data at some arbitrary offset within a 
buffer. At this point we have to interpret part of the block
// as an array of doubles. The data must include some encoding about how big 
that block is or how many items it contains

int numberOfDoubles = 

// at this point the caller can sanity-check the numberOfDoubles to make sure 
there's no buffer overrun, etc. The called function
// doesn't have any means to do that.

doStuffWithDoublesSubroutine((double*) ptrToCurrentData, numberOfDoubles );

// did the subroutine succeed? doesn't matter, move on to the next chunk:

ptrToCurrentData += ( sizeof(double) * numberOfDoubles );



Things might be different if your data is not parsable in this way, such as 
'keep going until you hit some marker or the end'. Even then it's often safer 
to lookahead to find the marker/end so you have a finite chunk to deal with, 
but if there's a chance that could be gigabytes away, it might be better to 
parse as you go. In that case returning a value indicating the number of items 
actually processed would allow the caller to calculate the offset for the next 
pointer, rather than rely on the called function to (correctly) do the pointer 
arithmetic for you as a side-effect.

Others might take another view, but I'd say keeping all your pointer arithmetic 
in one place is much easier to analyse and debug when it (inevitably) isn't 
correct - did anyone ever get pointer arithmetic absolutely spot on first time?

> But, basically you're right about the copy. This might be more canonical:
> 
> [foo point:NSMakePoint (* data, * (data + 1))];
> * data += dim;


well, double* is exactly the same as double[], so you can treat  as an 
array:

NSMakePoint( data[0], data[1])

which is usually more readable. That isn't a trick, it's an intentional feature 
of C.

I still wouldn't let the subroutine do the *data += dim though, when the caller 
can do it. If the caller really can't tell it how many to process in advance, 
arrange it to return a count of the number of items it did process as a return 
value, e.g:

int numProcessed = doStuffWithDoublesSubroutine((double*) ptrToCurrentData );
ptrToCurrentData = ( sizeof( double ) * numProcessed );

That way it's not a side-effect but a contractual obligation of the called 
function. But note that since the interior of this function can't see the whole 
buffer it's reading from, it has no way to stop instead of running off the end 
if the terminal condition is not met for some reason.

Hope this isn't too off-topic for Cocoa. If others take issue with my reasoning 
here I'd be interested to hear it - I just hate debugging stuff where the 
pointer arithmetic is all over the 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


Re: Run application before Login starts?

2010-07-07 Thread kirankumar

hi

thanks greg guerin.

From the SampleCode, i follow these steps for my application but its
not displaying my application ,its displays only menubar at the top
of the screen when login window appears.

Any how my app works fine, but when i login my appl was quit.But i
need my appl  to work, for that i need to change any properties in
plist or any other things i need to do .
 Below is my plist fields:

Label  --->com.xxx.xxx
LimitLoadToSessionType >LoginWindow
OnDemand   >No
>ProgramArguments
  0   ---> /Library/PrivilegedHelperTools/xxx.app/Contents/MacOS/
xxx


$ sudo mkdir -p /Library/PrivilegedHelperTools
Password:
$ sudo chown root:wheel /Library/PrivilegedHelperTools

Pre-login launchd agents are run as root and it is not appropriate to
place them in any directory that an admin user can modify without
authenticating.

3. Copy the agent to "/Library/PrivilegedHelperTools".

$ sudo cp -R PreLoginAgentCocoa/build/Debug/myapplication.app \
/Library/PrivilegedHelperTools/



4. Copy the property list file to "/Library/LaunchAgents".

$ sudo cp PreLoginAgentCocoa/com.yourscompany.myapplication.plist \
/Library/LaunchAgents/

$ sudo cp PreLoginAgentCarbon/com.yourscompany.myapplication.plist\
/Library/LaunchAgents/

5. Log out.

At the login screen you will see a window displaying the name of the
sample.  When you log in, the agent will quit and the window will go
away.




On Jul 5, 2010, at 11:22 PM, Greg Guerin wrote:


kirankumar wrote:


How to run a application before login starts (ie, before when we
enter username and password).



http://developer.apple.com/mac/library/technotes/tn2005/tn2083.html

   -- GG

___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/kiran.koduri%
40moschip.com

This email sent to kiran.kod...@moschip.com



The information contained in this email and any attachments is confidential and 
may be subject to copyright or other intellectual property protection. If you 
are not the intended recipient, you are not authorized to use or disclose this 
information, and we request that you notify us by reply mail or telephone and 
delete the original message from your mail system.
___

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: Continuous zoom in MKMapView

2010-07-07 Thread Paulo Andrade

On Jul 5, 2010, at 2:47 AM, Miguel Arroz wrote:

> Hello,
> 
>  I'm trying to control a map view programmatically, and I need to zoom in and 
> out with high accuracy (like when the user pinches it for zomming, the map 
> may display an arbitrary level of zoom when the user stops touching the view).
> 
>  However, when I do it programmatically, with setRegion:animated: or 
> setVisibleMapRect:animated:, the behavior is different than what I expect. It 
> appears that the map view has some predefined zoom levels, and it will 
> massage the region or rect I pass to those calls and adjust it to the nearest 
> approximation for those predefined zoom levels. This prevents me from setting 
> an arbitrary zoom level, or making a continuous zooming effect.
> 
>  Is there any way to tell the map view I want that specific region or rect, 
> and not the approximation?

I'm not sure about MKMapView but if it behaves the same way UIScrollView 
does... are those rects proportional to the view bounds?
I'm asking this because UIScrollView does an AspectFit to the rect you pass in 
when zooming, so to have complete control of where you want the final bounds to 
be, you need to pass a proportional rect.

> 
> Miguel Arroz
> 
> ___
> 
> 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/pfca%40mega.ist.utl.pt
> 
> This email sent to p...@mega.ist.utl.pt

___

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


Mobileme syncing of core data persistent store

2010-07-07 Thread Martin Hewitson
Dear list,

I have a core data app in which I have attempted to implement mobileme syncing. 
I have a helper class which implements the NSPersistentStoreCoordinatorSyncing 
protocol and I've implemented

- (NSArray 
*)managedObjectContextsToMonitorWhenSyncingPersistentStoreCoordinator:(NSPersistentStoreCoordinator
 *)coordinator
- (NSArray 
*)managedObjectContextsToReloadAfterSyncingPersistentStoreCoordinator:(NSPersistentStoreCoordinator
 *)coordinator

to return my single managed object context.

Everything is working sort of fine. The only problem is that changes synced 
from the cloud don't appear in the app until I restart it. The core data 
content is presented in an outline view / tableview combination. 

I've implemented 

- (ISyncChange *)persistentStoreCoordinator:(NSPersistentStoreCoordinator 
*)coordinator willApplyChange:(ISyncChange *)change 
toManagedObject:(NSManagedObject *)managedObject inSyncSession:(ISyncSession 
*)session

and tried calling -refreshObject:mergeChanges: on the managed object. This 
doesn't help.

Does anyone know what I have to do to get the changes pulled from the cloud to 
immediately appear in the 'live' managed object context?

And a side question: is it possible to 'force' a mobileme sync from within the 
app, so that I can offer the user the ability to sync to the cloud before 
terminating the app?

Many thanks in advance,

Martin


Martin Hewitson
Albert-Einstein-Institut
Max-Planck-Institut fuer 
Gravitationsphysik und Universitaet Hannover
Callinstr. 38, 30167 Hannover, Germany
Tel: +49-511-762-17121, Fax: +49-511-762-5861
E-Mail: martin.hewit...@aei.mpg.de
WWW: http://www.aei.mpg.de/~hewitson






___

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


UINavigationBar color in popover

2010-07-07 Thread Marcel Borsten
I've created a simple splitview. When the view is in portrait the tableview 
resides in a popover. In the popover view the navigationbar has a black color 
behind it (see image)

<>

Another popover that hold the same type of tableview does display normal:

<>

Anybody know what is going on here?

MB___

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: Pass-by value… warning

2010-07-07 Thread Greg Guerin

vincent habchi wrote:

That's true, the compiler cannot guarantee that dim > 1, which is  
always the case actually.
I am going to put an extra text at the beginning of the method,  
like: "if (dim < 1) return;" and see what happens.



If you need to guarantee dim > 1, then your if statement should be:
 if (dim <= 1) return

  -- GG

___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

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


NSButtonCell visibility in NSOutlineView.

2010-07-07 Thread Joshua Garnham
It seems to be a pretty simple task but I am unsure how to go about it.
I am looking to hide a checkbox in Column 0 if the row it's on has any children.

How would I do this?


Cheers.




___

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: NSButtonCell visibility in NSOutlineView.

2010-07-07 Thread Nick Zitzmann

On Jul 7, 2010, at 10:06 AM, Joshua Garnham wrote:

> It seems to be a pretty simple task but I am unsure how to go about it.
> I am looking to hide a checkbox in Column 0 if the row it's on has any 
> children.
> 
> How would I do this?

Try this: In your outline view delegate, implement 
-outlineView:dataCellForTableColumn:item: and return an empty cell in the place 
where you want to hide a cell. Otherwise, return the data cell for the column.

Nick Zitzmann


___

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: NSButtonCell visibility in NSOutlineView.

2010-07-07 Thread Joshua Garnham
Thanks, that worked just how I wanted it too!






From: Nick Zitzmann 
To: Joshua Garnham 
Cc: cocoa-dev@lists.apple.com
Sent: Wed, 7 July, 2010 17:24:12
Subject: Re: NSButtonCell visibility in NSOutlineView.


On Jul 7, 2010, at 10:06 AM, Joshua Garnham wrote:

> It seems to be a pretty simple task but I am unsure how to go about it.
> I am looking to hide a checkbox in Column 0 if the row it's on has any 
>children.
> 
> How would I do this?

Try this: In your outline view delegate, implement 
-outlineView:dataCellForTableColumn:item: and return an empty cell in the place 
where you want to hide a cell. Otherwise, return the data cell for the column.

Nick Zitzmann




___

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


Building a Spotlight-like custom NSMenu with an embedded NSSearchField

2010-07-07 Thread augusto callejas
hi-

i've built the beginning of my own custom NSMenu with an embedded NSSearchField.
i was wondering if the following behavior is possible:

in spotlight, when you enter a search term, you start getting results and the 
first term
is highlighted:

http://www.genielogic.com/page7/files/spotlightmenu-deathgrip.jpg

you can then use the arrow keys to navigate the results.

is it possible to do this when you have an embedded NSSearchField inside an 
NSMenuItem,
which has focus, but still have another NSMenuItem below it with focus and also 
be able to navigate
the rest of the NSMenu with arrow keys?  i'm not sure if this is possible 
because then focus would
be lost from the NSSearchField.

thanks,
augusto.___

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


iPad: CGPDF... methods and leak/cache

2010-07-07 Thread sebi
Hello,

I'm writing an app on iPad that lets the user navigate through a >700 page pdf. 
When he's on some page I preload the next and previous pages as UIImage (using 
CGContextDrawPDFPage()) so navigation is faster. Everything is fine at first, 
but after a few tens of pages the memory gets full and I can preload fewer and 
fewer images until I can't even create the UIImage for the current page. 
When I get a memory warning I unload most of the images and I also release the 
current CGPDFDocumentRef which should release the memory. 
Unfortunately it doesn't. ObjectAlloc shows me that I have thousands of small 
memory blocks hanging around between 8 bytes and 32 kilobytes that somehow were 
created in the CGPDF... methods.

For example, the 96 byte blocks are from here:
  18 CoreGraphics CGContextDrawPDFPage
  17 CoreGraphics CGPDFDrawingContextDraw
  16 CoreGraphics CGPDFScannerScan
  15 CoreGraphics read_objects
  14 CoreGraphics handle_xname
  13 CoreGraphics op_TJ
  12 CoreGraphics CGPDFDrawingContextDrawText
  11 CoreGraphics CGPDFTextLayoutDraw
  10 CoreGraphics draw_glyphs
   9 CoreGraphics draw_glyphs
   8 libRIP.A.dylib ripc_DrawGlyphs
   7 libRIP.A.dylib ripc_RenderGlyphs
   6 CoreGraphics CGGlyphLockLockGlyphBitmaps
   5 CoreGraphics create_missing_bitmaps
   4 CoreGraphics CGFontCreateGlyphBitmaps
   3 CoreGraphics CGFontCreateGlyphBitmaps8
   2 CoreGraphics CGFontGetGlyphPaths
   1 CoreGraphics glyph_path_end8
   0 CoreGraphics CGGlyphBitmapCreate

and there are over 3000 of them alive! More than 600 1kb blocks are from 
CGPDFDictionaryCreateWithObjects (called by CGPDFDocumentGetPage) and 
CGFontCacheSetValue (CGContextDrawPDFPage). And so on. 

The customer is very unhappy and I'm too. What can I do? Are these leaks? Or 
does CoreGraphics build up some cache which I can release or so? Right now the 
only object I actually create is a CGPDFDocumentRef which I  inside the 
didReceiveMemoryWarning method and recreate later on the next page request. 
Apart from that I only use CGPDFDocumentGet... methods which shouldn't return 
anything for me to release, right?

My basic assumption is, thet all these objects lead to some massive memory 
fragmentation so the systm can't alloc enough large chunks of memory for 
images. Is this reasonable? I assume this, because the total numer of memory 
used by my app always stays below 30 mb (as shown by ObjectAlloc's "Live 
Bytes") column.

Thanks and regards,
Sebastian Mecklenburg

___

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: Pass-by value? warning (was: NSTextField fieldeditor subclass example? (and an unrelated other inquiry))

2010-07-07 Thread Matt Neuburg
On Wed, 7 Jul 2010 07:59:38 +0200, vincent habchi  said:
>Hi!
>
>Maybe I should report this to the LLVM team?

You can, but I wouldn't get my knickers in a twist about it. The static
analyzer is just an analyzer. It does get some false positives, but so what?
Just think of it as a list of suggested things to maybe think about; it
isn't a definitive list of bugs or anything like that. m.

-- 
matt neuburg, phd = m...@tidbits.com, 
A fool + a tool + an autorelease pool = cool!
AppleScript: the Definitive Guide - Second Edition!
http://www.tidbits.com/matt/default.html#applescriptthings



___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

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


Re: iPad: CGPDF... methods and leak/cache

2010-07-07 Thread Kyle Sluder
On Wed, Jul 7, 2010 at 10:21 AM, sebi  wrote:
> When I get a memory warning I unload most of the images and I also release 
> the current CGPDFDocumentRef which should release the memory.
> Unfortunately it doesn't. ObjectAlloc shows me that I have thousands of small 
> memory blocks hanging around between 8 bytes and 32 kilobytes that somehow 
> were created in the CGPDF... methods.

I believe this is a known bug, as described in this thread:
http://lists.apple.com/archives/quartz-dev/2010/Apr/msg00024.html

quartz-dev is a more appropriate list for this thread.

--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


Programmatically highlighting an NSMenuItem (was: Building a Spotlight-like custom NSMenu with an embedded NSSearchField)

2010-07-07 Thread augusto callejas
hi-

i'd like to simplify my question from earlier:

how do i programmatically highlight an NSMenuItem inside an NSMenu?
i only see "isHighlighted" method in NSMenuItem, but no method for setting the 
currently highlighted menu item.

thanks,
augusto.___

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: Pass-by value? warning (was: NSTextField fieldeditor subclass example? (and an unrelated other inquiry))

2010-07-07 Thread Bill Bumgarner
I missed the OP's post

If the static analyzer is barfing up a false positive, please report it 
(http://bugreport.apple.com/ works fine).

b.bum

On Jul 7, 2010, at 10:34 AM, Matt Neuburg wrote:

>> Maybe I should report this to the LLVM team?
> 
> You can, but I wouldn't get my knickers in a twist about it. The static
> analyzer is just an analyzer. It does get some false positives, but so what?
> Just think of it as a list of suggested things to maybe think about; it
> isn't a definitive list of bugs or anything like that. m.

___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

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


static analyzer

2010-07-07 Thread Matt Neuburg
On or about 7/7/10 11:17 AM, thus spake "Bill Bumgarner" :

> I missed the OP's post
> 
> If the static analyzer is barfing up a false positive, please report it
> (http://bugreport.apple.com/ works fine).

Is that generally true? I mean, first of all, false positives are a
well-known phenomenon with this static analyzer (the Web page at llvm.org
talks about this). Second, they do no harm. I get a false positive in *any*
of my apps that uses NSURLConnection, for example:

NSURLConnection* con = [[NSURLConnection alloc] initWithRequest:req
delegate:self];

That triggers a "potential leak" warning. Well, of course it is a
*potential* leak. But it isn't a *real* leak, because I happen to know that
I'm going to release this object in either connection:didFailWithError: or
connectionDidFinishLoading:. (My code and memory management come right out
of Apple's own examples here.) I know how NSURLConnections work; the static
analyzer doesn't. But I would hardly call that a bug.

m.

-- 
matt neuburg, phd = m...@tidbits.com, http://www.tidbits.com/matt/
pantes anthropoi tou eidenai oregontai phusei
Among the 2007 MacTech Top 25, http://tinyurl.com/2rh4pf
AppleScript: the Definitive Guide, 2nd edition
http://www.tidbits.com/matt/default.html#applescriptthings
Take Control of Exploring & Customizing Snow Leopard
http://tinyurl.com/kufyy8
RubyFrontier! http://www.apeth.com/RubyFrontierDocs/default.html
TidBITS, Mac news and reviews since 1990, http://www.tidbits.com



___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

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


Re: static analyzer

2010-07-07 Thread Bill Bumgarner

On Jul 7, 2010, at 11:33 AM, Matt Neuburg wrote:

> On or about 7/7/10 11:17 AM, thus spake "Bill Bumgarner" :
> 
>> I missed the OP's post
>> 
>> If the static analyzer is barfing up a false positive, please report it
>> (http://bugreport.apple.com/ works fine).
> 
> Is that generally true? I mean, first of all, false positives are a
> well-known phenomenon with this static analyzer (the Web page at llvm.org
> talks about this). Second, they do no harm. I get a false positive in *any*
> of my apps that uses NSURLConnection, for example:

Yup.  That is really true.  False positives are taken very seriously.

> That triggers a "potential leak" warning. Well, of course it is a
> *potential* leak. But it isn't a *real* leak, because I happen to know that
> I'm going to release this object in either connection:didFailWithError: or
> connectionDidFinishLoading:. (My code and memory management come right out
> of Apple's own examples here.) I know how NSURLConnections work; the static
> analyzer doesn't. But I would hardly call that a bug.

The static analyzer can be taught about the idiosyncrasies of NSURLConnection.

While the compilers are all about generically compiling code and making sure 
your code can be predictably evaluated within the defines of the standard and 
mores of the language,  the static analyzer is very much all about making sure 
your code is behaving appropriately within the confines of the targeted APIs.

b.bum
___

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: Pass-by value … warning (was: NSTextFie ld fieldeditor subclass example? (and an unrelated other in quiry))

2010-07-07 Thread Sean McBride
On Wed, 7 Jul 2010 07:59:38 +0200, vincent habchi said:

>The analyzer does not figure out that the pt array gets initialized
>through the loop by copying values directly from a chunk of memory, and
>spits out the warning about pt [•] not being defined. Maybe I should
>report this to the LLVM team?

You might want to try with a new build of the analyzer.  You can install
a binary:


or build from trunk even.

And if you find bugs, file them here:


It's a much more open process that Apple's bugreporter.

-- 

Sean McBride, B. Eng s...@rogue-research.com
Rogue Researchwww.rogue-research.com 
Mac Software Developer  Montréal, Québec, Canada
___

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

How to catch [NSEvent dealloc]?

2010-07-07 Thread Paul Sanders
I have a problem.  I need to know when an NSApplicationDefined NSEvent is 
deallocated, because it contains a reference to an object in data1 and I want 
to release that object at that time.  Problem is, you can't subclass NSEvent 
because there are no public initialisers.  Short of swizzling [NSEvent dealloc] 
(erk!) does anyone have an idea about how I might be able to catch an NSEvent 
object at the point of deallocation?

Many thanks,

Paul Sanders.
___

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


Sanity Check

2010-07-07 Thread koko

Does this code make sense? Where

[[ SewAndColorController alloc] initWithWindowNibName:@"nibName"]

is called from another view action?


@interface SewAndColorController : NSWindowController {

NSPanel *m_panel;
}

@end

#import "SewAndColorController.h"

@implementation SewAndColorController

- (id) initWithWindowNibName:(NSString*)windowNibName
{
self = [super initWithWindowNibName:windowNibName];
if (self != nil)
{
[self retain];
m_panel = [self window];
[m_panel setDelegate:self]; 
[m_panel makeKeyAndOrderFront:self];
}
return self;
}
@end



___

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: Sanity Check

2010-07-07 Thread Dave DeLong
Why are you retaining self?  Other than that, yes it looks fine (assuming 
you're assigning the results of [[SewAndColorController alloc] init...] into a 
variable).

Dave

On Jul 7, 2010, at 2:07 PM, k...@highrolls.net wrote:

> Does this code make sense? Where
> 
> [[ SewAndColorController alloc] initWithWindowNibName:@"nibName"]
> 
> is called from another view action?
> 
> 
> @interface SewAndColorController : NSWindowController {
> 
>   NSPanel *m_panel;
> }
> 
> @end
> 
> #import "SewAndColorController.h"
> 
> @implementation SewAndColorController
> 
> - (id) initWithWindowNibName:(NSString*)windowNibName
> {
>   self = [super initWithWindowNibName:windowNibName];
>   if (self != nil)
>   {
>   [self retain];
>   m_panel = [self window];
>   [m_panel setDelegate:self]; 
>   [m_panel makeKeyAndOrderFront:self];
>   }
>   return self;
> }
> @end
> 
> 
> 
> ___
> 
> 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/davedelong%40me.com
> 
> This email sent to davedel...@me.com



smime.p7s
Description: S/MIME cryptographic signature
___

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

Restricting control characters in an NSSearchField/NSTextField

2010-07-07 Thread augusto callejas
hi-

i have an NSSearchField embedded in an NSMenu and when i have another 
NSMenuItem highlighted,
and i navigate the menu using the up and down arrows, those characters are 
being added to my
NSSearchField (i.e. 0x30, 0x31, etc), but i'd rather not have those characters 
added to the string text
of my NSSearchField.  is there a way to restrict those characters from being 
added to my search field?

thanks,
augusto.___

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


2009 WWDC videos

2010-07-07 Thread Rainer Standke
Hello all,

I just realized that the 2010 WWDC videos are accessible now - but what about 
the ones from 2009? Is there a way to ask Apple to make them available?

Thanks,

Rainer___

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


Fwd: Sanity Check

2010-07-07 Thread koko



Begin forwarded message:


From: k...@highrolls.net
Date: July 7, 2010 2:24:18 PM MDT
To: Dave DeLong 
Subject: Re: Sanity Check

Ok that was my concern.  I am not assigning [[SewAndColorController  
alloc] init...] into a variable ergo I thought I should [self  
retain] and the release it when the panel is closed.


So question ... if I do not assign [[SewAndColorController alloc]  
init...] into a variable does that present any problem?



On Jul 7, 2010, at 2:10 PM, Dave DeLong wrote:

Why are you retaining self?  Other than that, yes it looks fine  
(assuming you're assigning the results of [[SewAndColorController  
alloc] init...] into a variable).


Dave

On Jul 7, 2010, at 2:07 PM, k...@highrolls.net wrote:


Does this code make sense? Where

[[ SewAndColorController alloc] initWithWindowNibName:@"nibName"]

is called from another view action?


@interface SewAndColorController : NSWindowController {

NSPanel *m_panel;
}

@end

#import "SewAndColorController.h"

@implementation SewAndColorController

- (id) initWithWindowNibName:(NSString*)windowNibName
{
self = [super initWithWindowNibName:windowNibName];
if (self != nil)
{
[self retain];
m_panel = [self window];
[m_panel setDelegate:self]; 
[m_panel makeKeyAndOrderFront:self];
}
return self;
}
@end



___

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/davedelong%40me.com

This email sent to davedel...@me.com


___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/koko%40highrolls.net

This email sent to k...@highrolls.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: static analyzer

2010-07-07 Thread vincent habchi
Le 7 juil. 2010 à 20:35, Bill Bumgarner a écrit :

>> Is that generally true? I mean, first of all, false positives are a
>> well-known phenomenon with this static analyzer (the Web page at llvm.org
>> talks about this). Second, they do no harm. I get a false positive in *any*
>> of my apps that uses NSURLConnection, for example:
> 
> Yup.  That is really true.  False positives are taken very seriously.

At the end, as I wrote, it turns out it was not really a false positive, but 
the message was somewhat unclear (sibylline, is that English?). The warning has 
gone away when I put the test before, so I assume this is normal and desired 
behavior. However it does raise the question to know if the static analyzer can 
figure out twisted initialization with functions such as memcpy. 

The response as far I can fathom it out of a few simple tests is yes in most 
cases but sometimes no.

The following code:

int main (int argc, const char * argv[]) {
NSAutoreleasePool * pool = [[NSAutoreleasePool alloc] init];
int foo;
int fee;

// insert code here...
NSLog(@"Hello, World!");
// memcpy (& fee, & foo, sizeof (foo));
Logit (fee);

[pool drain];
return 0;
}

correctly produces a warning about 'foo' not be used and the famous message 
"Pass-by-value argument in function call is undefined" that should best be 
written as "passED-by-value argument in function call is undefined" (as far as 
my understanding of the English grammar goes).

Now, this code: 

int main (int argc, const char * argv[]) {
NSAutoreleasePool * pool = [[NSAutoreleasePool alloc] init];
int foo;
int fee;

// insert code here...
NSLog(@"Hello, World!");
fee = foo;
// memcpy (& fee, & foo, sizeof (foo));
Logit (fee);

[pool drain];
return 0;
}

itches the analyzer with an "Assigned value is garbage or undefined" message on 
the line fee = foo, which is nice. Was it right to cancel the warning about the 
undefined parameter? That's questionable but admissible.

Now this version :

int main (int argc, const char * argv[]) {
NSAutoreleasePool * pool = [[NSAutoreleasePool alloc] init];
int foo;
int fee;

// insert code here...
NSLog(@"Hello, World!");
memcpy (& fee, & foo, sizeof (foo));
Logit (fee);

[pool drain];
return 0;
}

does not make the static analyzer protest, so I assume its default behavior is 
to assume that any variable used as a destination of memcpy is initialized, 
regardless of the source. But, IMO, we have already encroached on a semantic 
realm beyond the reach of any decent general purpose code analyzer.

Vincent (with my excuses to the moderator for being also borderline as to the 
contents. I swear I will post further responses off 
list).___

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: How to catch [NSEvent dealloc]?

2010-07-07 Thread Michael Ash
On Wed, Jul 7, 2010 at 3:53 PM, Paul Sanders  wrote:
> I have a problem.  I need to know when an NSApplicationDefined NSEvent is 
> deallocated, because it contains a reference to an object in data1 and I want 
> to release that object at that time.  Problem is, you can't subclass NSEvent 
> because there are no public initialisers.  Short of swizzling [NSEvent 
> dealloc] (erk!) does anyone have an idea about how I might be able to catch 
> an NSEvent object at the point of deallocation?

If you can require 10.6 (or iOS 4, maybe?) then you can use the new
associated object API. Use objc_setAssociatedObject to attach your
object to the NSEvent object, and the runtime will automatically take
care of destroying it for you when the NSEvent is destroyed.

Mike
___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

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


Re: static analyzer

2010-07-07 Thread Michael Ash
On Wed, Jul 7, 2010 at 2:33 PM, Matt Neuburg  wrote:
> On or about 7/7/10 11:17 AM, thus spake "Bill Bumgarner" :
>
>> I missed the OP's post
>>
>> If the static analyzer is barfing up a false positive, please report it
>> (http://bugreport.apple.com/ works fine).
>
> Is that generally true? I mean, first of all, false positives are a
> well-known phenomenon with this static analyzer (the Web page at llvm.org
> talks about this). Second, they do no harm.

False positives do a lot of harm. For the reductio ad absurdum
argument, imagine if the analyzer threw out a false positive on every
line of your code. That would obviously make the tool completely
worthless, as you would never be able to find the true positives.

For a more realistic argument, consider that each false positive
increases your mental load, increases the probability that you'll
inadvertently ignore a true positive, and overall increases the cost
and reduces the benefit of using the analyzer.

The ultimate goal of such a tool should be zero false positives and
zero false negatives. This is of course impossible, but they are
*both* harmful, and it's a good thing to reduce each of them.

> I get a false positive in *any*
> of my apps that uses NSURLConnection, for example:
>
> NSURLConnection* con = [[NSURLConnection alloc] initWithRequest:req
> delegate:self];
>
> That triggers a "potential leak" warning. Well, of course it is a
> *potential* leak. But it isn't a *real* leak, because I happen to know that
> I'm going to release this object in either connection:didFailWithError: or
> connectionDidFinishLoading:. (My code and memory management come right out
> of Apple's own examples here.) I know how NSURLConnections work; the static
> analyzer doesn't. But I would hardly call that a bug.

I would call it potentially dangerous code. It's much better, IMO, to
place the connection into an instance variable and that way balance
all of your retains and releases. Each exception to the standard
memory management pattern that you make increases the odds of screwing
something up.

Mike
___

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: How to catch [NSEvent dealloc]?

2010-07-07 Thread Paul Sanders
> If you can require 10.6 (or iOS 4, maybe?) then you can use the new
> associated object API. Use objc_setAssociatedObject to attach your
> object to the NSEvent object, and the runtime will automatically take
> care of destroying it for you when the NSEvent is destroyed.

Sadly (and possibly mistakenly), I'm still supporting 10.4.  I think I need to 
review this policy!  Good idea though.

Regards,

Paul Sanders.
___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

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


NSWindowController window returns nil

2010-07-07 Thread koko
- (id) initWithWindowNibName:(NSString*)windowNibName andBFileName: 
(BFilename*)bfilename

{
self = [super initWithWindowNibName:windowNibName];
if (self != nil)
{
m_panel = [self window];
Design *cv = [m_panel contentView];
cv->m_BFilename = bfilename;
[m_panel setDelegate:self]; 
[m_panel makeKeyAndOrderFront:self];
}
return self;
}



Im the above, the call [self window] returns nil. This does not seem  
correct. Can some one help me?


-koko
___

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: Sanity Check

2010-07-07 Thread Chris Hanson
On Jul 7, 2010, at 1:25 PM, k...@highrolls.net wrote:

> Ok that was my concern.  I am not assigning [[SewAndColorController alloc] 
> init...] into a variable ergo I thought I should [self retain] and the 
> release it when the panel is closed.

Better style would be to still assign the new instance of SewAndColorController 
to a variable, and release it when you’re done with the associated window.

If it’s intended to be a “shared” window that can be brought up and hidden, but 
needs to stay “alive” and of which there’s supposed to only be one instance, 
you’d probably be better off adding a +sharedSewAndColorController method that 
returns a singleton instance (allocating one if it doesn’t exist yet).

  — Chris

___

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: Sanity Check

2010-07-07 Thread koko

Thank you Chris!

Even though it would be better style would my approach cause any  
problem?  I don't see any.


-koko

On Jul 7, 2010, at 5:02 PM, Chris Hanson wrote:


On Jul 7, 2010, at 1:25 PM, k...@highrolls.net wrote:

Ok that was my concern.  I am not assigning [[SewAndColorController  
alloc] init...] into a variable ergo I thought I should [self  
retain] and the release it when the panel is closed.


Better style would be to still assign the new instance of  
SewAndColorController to a variable, and release it when you’re done  
with the associated window.


If it’s intended to be a “shared” window that can be brought up and  
hidden, but needs to stay “alive” and of which there’s supposed to  
only be one instance, you’d probably be better off adding a  
+sharedSewAndColorController method that returns a singleton  
instance (allocating one if it doesn’t exist yet).


 — Chris




___

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


Programmatically closing a submenu (NSMenu)

2010-07-07 Thread augusto callejas
hi-

i have an NSMenu that has another NSMenu as a submenu (via an NSMenuItem).
in a certain situation, when the submenu is visible, i want to close that 
submenu, but without closing the main NSMenu.
the documentation for [NSMenu cancelTracking] says it dismisses the menu, but 
when i call that on the submenu,
it dismisses the submenu but also the main NSMenu.

how can i only close a submenu without affecting the main menu?

thanks,
augusto.___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

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


Re: NSWindowController window returns nil

2010-07-07 Thread Kyle Sluder
On Wed, Jul 7, 2010 at 3:54 PM,   wrote:
> - (id) initWithWindowNibName:(NSString*)windowNibName
> andBFileName:(BFilename*)bfilename
> {
>        self = [super initWithWindowNibName:windowNibName];
>        if (self != nil)
>        {
>                m_panel = [self window];
>                Design *cv = [m_panel contentView];
>                cv->m_BFilename = bfilename;
>                [m_panel setDelegate:self];
>                [m_panel makeKeyAndOrderFront:self];
>        }
>        return self;
> }
>
>
>
> Im the above, the call [self window] returns nil. This does not seem
> correct. Can some one help me?

Well, for starters, your window controller initializer probably
shouldn't put up the window.

Did you remember to hook up the window in the nib to File's Owner's
window outlet? Did you remember to change the class identity of File's
Owner to your NSWindowController subclass?

--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: NSWindowController window returns nil

2010-07-07 Thread koko
Yeah, I remembered all those things after I posted ... sorry for  
wasting bandwidth!


-koko

On Jul 7, 2010, at 5:23 PM, Kyle Sluder wrote:


On Wed, Jul 7, 2010 at 3:54 PM,   wrote:

- (id) initWithWindowNibName:(NSString*)windowNibName
andBFileName:(BFilename*)bfilename
{
   self = [super initWithWindowNibName:windowNibName];
   if (self != nil)
   {
   m_panel = [self window];
   Design *cv = [m_panel contentView];
   cv->m_BFilename = bfilename;
   [m_panel setDelegate:self];
   [m_panel makeKeyAndOrderFront:self];
   }
   return self;
}



Im the above, the call [self window] returns nil. This does not seem
correct. Can some one help me?


Well, for starters, your window controller initializer probably
shouldn't put up the window.

Did you remember to hook up the window in the nib to File's Owner's
window outlet? Did you remember to change the class identity of File's
Owner to your NSWindowController subclass?

--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: Pass-by value… warning

2010-07-07 Thread Ken Thomases
On Jul 7, 2010, at 10:27 AM, Greg Guerin wrote:

> vincent habchi wrote:
> 
>> That's true, the compiler cannot guarantee that dim > 1, which is always the 
>> case actually.
>> I am going to put an extra text at the beginning of the method, like: "if 
>> (dim < 1) return;" and see what happens.
> 
> If you need to guarantee dim > 1, then your if statement should be:
> if (dim <= 1) return

Also, you can use an assertion, even a custom assertion 
, and the 
analyzer will recognize it as truncating that particular code path.

Cheers,
Ken

___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

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


Re: Sanity Check

2010-07-07 Thread Ken Thomases
On Jul 7, 2010, at 6:09 PM, k...@highrolls.net wrote:

> Even though it would be better style would my approach cause any problem?  I 
> don't see any.

Yes.  You alloc+init and you also retain.  Then, you (presumably) only release 
once when the panel closes.  Thus, you are leaking the window controller.  If 
you're going to go with a self-owning window controller, then either:

1) You should not retain self and the release on close balances the alloc.

OR

2) The code which does the alloc should also release (balanced), and the window 
controller should both retain and release itself (balanced).

If you insist on going this route, I guess I recommend 2 since it makes it 
clearer that both pieces of code balance their own responsibilities.  With 1, 
the responsibilities are split between two unrelated parts of the code.

Regards,
Ken

___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

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


Re: Programmatically highlighting an NSMenuItem

2010-07-07 Thread Graham Cox

On 08/07/2010, at 3:47 AM, augusto callejas wrote:

> hi-
> 
> i'd like to simplify my question from earlier:
> 
> how do i programmatically highlight an NSMenuItem inside an NSMenu?
> i only see "isHighlighted" method in NSMenuItem, but no method for setting 
> the currently highlighted menu item.


NSMenuItemCell inherits -setHighlighted: from NSCell

--Graham


___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

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


Re: static analyzer

2010-07-07 Thread Matt Neuburg
On Wed, 7 Jul 2010 17:54:58 -0400, Michael Ash  said:
>> I get a false positive in *any*
>> of my apps that uses NSURLConnection, for example:
>>
>> NSURLConnection* con = [[NSURLConnection alloc] initWithRequest:req
>> delegate:self];
>>
>> That triggers a "potential leak" warning. Well, of course it is a
>> *potential* leak. But it isn't a *real* leak, because I happen to know that
>> I'm going to release this object in either connection:didFailWithError: or
>> connectionDidFinishLoading:. (My code and memory management come right out
>> of Apple's own examples here.) I know how NSURLConnections work; the static
>> analyzer doesn't. But I would hardly call that a bug.
>
>I would call it potentially dangerous code. It's much better, IMO, to
>place the connection into an instance variable and that way balance
>all of your retains and releases. Each exception to the standard
>memory management pattern that you make increases the odds of screwing
>something up.

Yes, I agree, and I did think of doing that to see if it would silence the
warning. But a beginner might not realize that - and, as I say, my code is
copied and pasted right out of Apple's example; it's up to Apple to change
the example if it's dangerous...

http://developer.apple.com/iphone/library/documentation/Cocoa/Conceptual/URL
LoadingSystem/Tasks/UsingNSURLConnection.html

m.
-- 
matt neuburg, phd = m...@tidbits.com, 
A fool + a tool + an autorelease pool = cool!
AppleScript: the Definitive Guide - Second Edition!
http://www.tidbits.com/matt/default.html#applescriptthings



___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

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


Re: NSWindowController window returns nil

2010-07-07 Thread Matt Neuburg
On Wed, 7 Jul 2010 16:54:04 -0600, k...@highrolls.net said:
>- (id) initWithWindowNibName:(NSString*)windowNibName andBFileName:
>(BFilename*)bfilename
>{
> self = [super initWithWindowNibName:windowNibName];
> if (self != nil)
> {
>  m_panel = [self window];
>  Design *cv = [m_panel contentView];
>  cv->m_BFilename = bfilename;
>  [m_panel setDelegate:self];  
>  [m_panel makeKeyAndOrderFront:self];
> }
> return self;
>}
>
>
>
>Im the above, the call [self window] returns nil. This does not seem
>correct. Can some one help me?

You're speaking of the window too early. This is just the init; the nib
hasn't yet loaded and set up the connections. This is why you are given
windowDidLoad, so you know when the window *is* ready.

I would go even further and say that most of what you're doing here should
not be done in an init. Set instance variables and that's all. And set them
directly; don't pass through a setter. Remember, the instance (self) is not
ready until you have *returned* from the init. m.

-- 
matt neuburg, phd = m...@tidbits.com, 
A fool + a tool + an autorelease pool = cool!
AppleScript: the Definitive Guide - Second Edition!
http://www.tidbits.com/matt/default.html#applescriptthings



___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

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


Re: NSWindowController window returns nil

2010-07-07 Thread Kyle Sluder
On Wed, Jul 7, 2010 at 5:47 PM, Matt Neuburg  wrote:
> You're speaking of the window too early. This is just the init; the nib
> hasn't yet loaded and set up the connections. This is why you are given
> windowDidLoad, so you know when the window *is* ready.

-[NSWindowController window] loads the nib.

--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: Programmatically highlighting an NSMenuItem

2010-07-07 Thread Kyle Sluder
On Wed, Jul 7, 2010 at 5:29 PM, Graham Cox  wrote:
> NSMenuItemCell inherits -setHighlighted: from NSCell

Does NSMenuItemCell match the appearance of menus on 10.5?

--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: Programmatically highlighting an NSMenuItem

2010-07-07 Thread Graham Cox

On 08/07/2010, at 11:00 AM, Kyle Sluder wrote:

> Does NSMenuItemCell match the appearance of menus on 10.5?


No. I noticed this in the docs just after posting: "Note: NSMenuItemCell is no 
longer used to draw menus. Using it will not affect the appearance of your 
menus."

Maybe the OP ought to tell us why he needs this, sounds like one of those 
'don't do it that way' cases.

--Graham


___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

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


Re: NSWindowController window returns nil

2010-07-07 Thread koko

Thanks for th input Matt.

I found that I had not connected the window outlet in Files Owner to  
the window in the nib.  Upon doing so all works as I expected.


As an FYI everything else works as I expect ... the delegate methods  
are called and the instance vars are good to go. One slight change, I  
made my content view an instance var so the code now looks like this:


- (id) initWithWindowNibName:(NSString*)windowNibName andBFileName: 
(BFilename*)bfilename

{
self = [super initWithWindowNibName:windowNibName];
if (self != nil)
{
[self retain];
m_panel = [self window];
m_design = [m_panel contentView];
m_design->m_BFilename = bfilename;
[m_panel setDelegate:self]; 
[m_panel makeKeyAndOrderFront:self];
}
return self;
}

- (void)windowWillClose:(NSNotification *)notification {

[self release];
}


Thanks to all for helping me keep my direction true!

-koko

On Jul 7, 2010, at 6:47 PM, Matt Neuburg wrote:


On Wed, 7 Jul 2010 16:54:04 -0600, k...@highrolls.net said:

- (id) initWithWindowNibName:(NSString*)windowNibName andBFileName:
(BFilename*)bfilename
{
self = [super initWithWindowNibName:windowNibName];
if (self != nil)
{
m_panel = [self window];
Design *cv = [m_panel contentView];
cv->m_BFilename = bfilename;
[m_panel setDelegate:self];
[m_panel makeKeyAndOrderFront:self];
}
return self;
}



Im the above, the call [self window] returns nil. This does not seem
correct. Can some one help me?


You're speaking of the window too early. This is just the init; the  
nib
hasn't yet loaded and set up the connections. This is why you are  
given

windowDidLoad, so you know when the window *is* ready.

I would go even further and say that most of what you're doing here  
should
not be done in an init. Set instance variables and that's all. And  
set them
directly; don't pass through a setter. Remember, the instance (self)  
is not

ready until you have *returned* from the init. m.

--
matt neuburg, phd = m...@tidbits.com, 
A fool + a tool + an autorelease pool = cool!
AppleScript: the Definitive Guide - Second Edition!
http://www.tidbits.com/matt/default.html#applescriptthings






___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

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


Re: static analyzer

2010-07-07 Thread Michael Ash
On Wed, Jul 7, 2010 at 8:41 PM, Matt Neuburg  wrote:
> On Wed, 7 Jul 2010 17:54:58 -0400, Michael Ash  said:
>>> I get a false positive in *any*
>>> of my apps that uses NSURLConnection, for example:
>>>
>>> NSURLConnection* con = [[NSURLConnection alloc] initWithRequest:req
>>> delegate:self];
>>>
>>> That triggers a "potential leak" warning. Well, of course it is a
>>> *potential* leak. But it isn't a *real* leak, because I happen to know that
>>> I'm going to release this object in either connection:didFailWithError: or
>>> connectionDidFinishLoading:. (My code and memory management come right out
>>> of Apple's own examples here.) I know how NSURLConnections work; the static
>>> analyzer doesn't. But I would hardly call that a bug.
>>
>>I would call it potentially dangerous code. It's much better, IMO, to
>>place the connection into an instance variable and that way balance
>>all of your retains and releases. Each exception to the standard
>>memory management pattern that you make increases the odds of screwing
>>something up.
>
> Yes, I agree, and I did think of doing that to see if it would silence the
> warning. But a beginner might not realize that - and, as I say, my code is
> copied and pasted right out of Apple's example; it's up to Apple to change
> the example if it's dangerous...
>
> http://developer.apple.com/iphone/library/documentation/Cocoa/Conceptual/URL
> LoadingSystem/Tasks/UsingNSURLConnection.html

Well, and I mean no offense to anyone reading this who's written some,
Apple sample code is not always all that great. In my experience, it's
often very good for learning how something can be accomplished, but
much less often a good example of style or good practices.

If a beginner wouldn't realize that it's dangerous, then all the more
reason to have the static analyzer complain about it.

Mike
___

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: How to catch [NSEvent dealloc]?

2010-07-07 Thread Michael Ash
On Wed, Jul 7, 2010 at 6:34 PM, Paul Sanders  wrote:
>> If you can require 10.6 (or iOS 4, maybe?) then you can use the new
>> associated object API. Use objc_setAssociatedObject to attach your
>> object to the NSEvent object, and the runtime will automatically take
>> care of destroying it for you when the NSEvent is destroyed.
>
> Sadly (and possibly mistakenly), I'm still supporting 10.4.  I think I need
> to review this policy!  Good idea though.

In that case I'd guess you might want to use method swizzling on
-[NSEvent dealloc]:

http://www.cocoadev.com/index.pl?MethodSwizzling

Beware that swizzling is a powerful and dangerous technique, and you
want to code your override with the utmost caution, but it's a great
way to intercept methods like this.

Mike
___

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: How to catch [NSEvent dealloc]?

2010-07-07 Thread Ken Thomases
On Jul 8, 2010, at 12:03 AM, Michael Ash wrote:

> On Wed, Jul 7, 2010 at 6:34 PM, Paul Sanders  
> wrote:
>>> If you can require 10.6 (or iOS 4, maybe?) then you can use the new
>>> associated object API. Use objc_setAssociatedObject to attach your
>>> object to the NSEvent object, and the runtime will automatically take
>>> care of destroying it for you when the NSEvent is destroyed.
>> 
>> Sadly (and possibly mistakenly), I'm still supporting 10.4.  I think I need
>> to review this policy!  Good idea though.
> 
> In that case I'd guess you might want to use method swizzling on
> -[NSEvent dealloc]:
> 
> http://www.cocoadev.com/index.pl?MethodSwizzling
> 
> Beware that swizzling is a powerful and dangerous technique, and you
> want to code your override with the utmost caution, but it's a great
> way to intercept methods like this.

Since the event is application-defined, any handler will, of course, also be 
application-defined.  Can't you handle this in the handler?  Or, alternatively, 
in an override of -[NSApplication sendEvent:]?

Regards,
Ken

___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

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


setting focus on NSSearchField in status bar menu item

2010-07-07 Thread Nava Carmon
Hi,

I added a custom view with a NSSearchField as a first menu item to a status bar 
menu. When I run the application from debugger I can click and write in the 
NSSearchField. After I go to another application, make it front and click again 
on my status menu, the NSSearchField shows, but it's disabled and can't get 
focus. The question is how to cause the NSSearchField to get focus each time, 
the user clicks to show the menu?

Thanks,

Nava


Nava Carmon
ncar...@mac.com

"Think good and it will be good!"

___

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


NSArchiverArchiveInconsistency

2010-07-07 Thread John MacMullin
I have been using NSStreams and the delegate with TCPServer quite successfully 
in the past to transmit data between a client and a server.  In other words, 
the code was working on 10.5 before.  Then I upgraded to 10.6 SDK with a 
deployment of 10.5.  Everything runs fine between the 10.6 server and 10.6 
client.  However, under 10.5 running on an iBook, the client is now failing 
with an NSArchiverArchiveInconsistency error when I unarchive the data read 
from the server.  When counting bytes transferred, the 10.5 client is reading 
almost twice as much data as the server writes.

Has anyone seen anything like this where client-server code once working on 
10.5 fails on 10.5 with an NSArchiverArchiveInconsistency error or appears to 
"double-read" the buffer after upgrading to 10.6?  I realize that this is a 
pretty general question and without code is a fishing expedition.

But even pan fry would help.

So, if you've seen something like this, please give me an idea of what you did 
to correct it.  Any ideas would be welcome.

Really frustrated at the moment,

John MacMullin

___

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