Re: SelectedRowIndexes

2009-10-14 Thread Peter Hudson

We offer a drag and drop option as well - very similar to your idea.
The problem is that our users find it easier to scroll their way  
through the list and command click on the appropriate rows.


Users prefer to have their way I find.


Peter



On 15 Oct 2009, at 07:45, Graham Cox wrote:



On 15/10/2009, at 5:24 PM, Peter Hudson wrote:

The user has an NSTableView in which is presented a number of  
elements ( 1 per row, typically  20 - 200 rows  )  out of which  
they need to produce a number of sequenced sub groups.
The user presses the 'Start Sub Group' key ( i.e. clear the  
sequence selection cache )  and then by picking a possible sequence  
( one row/element  at a time ) they build a group.
As the group is selected, further info about that particular sub  
group of elements is presented.

They can close/abort/store a given sub group at any time.



That does make some sense, but falls into the trap of not avoiding  
modes (in this case a "build subgroup" mode).


If it were me, I'd have two lists: a master list and a sub-group  
list. Drag items from the master to the group, and allow drag  
reordering of the group to set the sequence. As a short-cut you  
could allow a double-click on an item in the master list to add it  
to the end of the subgroup, which almost duplicates the current  
approach but with a double-click instead of a single, yet avoids the  
mode.


Just a thought ;-)

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

2009-10-14 Thread Graham Cox


On 15/10/2009, at 5:24 PM, Peter Hudson wrote:

The user has an NSTableView in which is presented a number of  
elements ( 1 per row, typically  20 - 200 rows  )  out of which they  
need to produce a number of sequenced sub groups.
The user presses the 'Start Sub Group' key ( i.e. clear the sequence  
selection cache )  and then by picking a possible sequence ( one row/ 
element  at a time ) they build a group.
As the group is selected, further info about that particular sub  
group of elements is presented.

They can close/abort/store a given sub group at any time.



That does make some sense, but falls into the trap of not avoiding  
modes (in this case a "build subgroup" mode).


If it were me, I'd have two lists: a master list and a sub-group list.  
Drag items from the master to the group, and allow drag reordering of  
the group to set the sequence. As a short-cut you could allow a double- 
click on an item in the master list to add it to the end of the  
subgroup, which almost duplicates the current approach but with a  
double-click instead of a single, yet avoids the mode.


Just a thought ;-)

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

2009-10-14 Thread Peter Hudson
The user has an NSTableView in which is presented a number of elements  
( 1 per row, typically  20 - 200 rows  )  out of which they need to  
produce a number of sequenced sub groups.
The user presses the 'Start Sub Group' key ( i.e. clear the sequence  
selection cache )  and then by picking a possible sequence ( one row/ 
element  at a time ) they build a group.
As the group is selected, further info about that particular sub group  
of elements is presented.

They can close/abort/store a given sub group at any time.

Peter




On 15 Oct 2009, at 00:12, Graham Cox wrote:



On 15/10/2009, at 10:01 AM, Peter Hudson wrote:

I have tackled this problem by using the NSTableView delegate  
method  tableViewSelectionDidChange:


In this method I query the table for selected rows and then compare  
with the index set from the previous call to
tableViewSelectionDidChange:   I simply store the incremental  
changes in sequence.



Like Kyle I'm curious about the rationale for this. Since there's no  
indication of how time played its part in coming up with the  
selection, doesn't this lead to strange behaviour for the user? What  
if I made a selection, got interrupted and only got back to work  
several hours later? How would what happened next make sense given  
that I'd almost certainly forgotten the selection sequence and had  
no feedback to remind me? Or does the selection get reflected in a  
second list that shows the sequence? That would make more sense but  
a pure selection with a hidden time element seems like a problematic  
UI to me.


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


Opening a NSSavePanel as a Sheet, and blocking like in [panel runModal]

2009-10-14 Thread Motti Shneor
Hello.

I'm in a strange situation, where I am implementing a plugin component  
that runs within a host application which I don't have access to.

Within this context, The host sometimes calls my plug-in to open an  
NSSavePanel (or NSOpenPanel). The host expects that I'm synchronous  
--- i.e. I only return when the NSSavePanel is dismissed, and there's  
a result.

However, The host also provides me with its own Window, and I need to  
open my NSSavePanel as a Sheet-window over the host's window.

Now NSSavePanel (and NSOpenPanel) provide 2 different ways to run them

1. runModal (or a vaiant) that is synchronous --- but it does not  
create a sheet window
2 beginSheetFor... (or variants) that are asynchronous (I must supply  
with a callback selector to be called
as the NSSavePanel is dismissed) --- these DO create a sheet over the  
parent window.

Is there a decent way to combine these two requirements? Can I somehow  
call

{
.
.
.

NSSavePanel *myPanel = [NSSavePanel panel];
[myPanel setParentWindow: hostWindow];
[myPanel runModal]

// and here, call something to block until the dismissal callback is  
called?
[somehow block here]

// extract the result.
return;
}

Thanks a lot!


Motti Shneor
--
Senior Software Engineer
Waves Audio ltd.

___

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: Code Sign verification on Leopard

2009-10-14 Thread Kyle Sluder
On Wed, Oct 14, 2009 at 9:35 PM, Charles Srstka
 wrote:
> Unless, of course, the app checked its code signature.

Put malicious library in temp dir.  Set DYLD_LIBRARY_PATH.  Game over.

--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: Code Sign verification on Leopard

2009-10-14 Thread Charles Srstka

On Oct 14, 2009, at 11:40 PM, Jeff Laing wrote:

Actually, heck, you wouldn't even need that. All a virus would have  
to

do would be to move the binary somewhere else and put a binary in its
place that does something malicious and then launches the real  
binary,

and the user would never tell the difference.

Unless, of course, the app checked its code signature.


Ok, I'll bite.  How does the real binary checking its code signature  
detect the case you just described? Its 100% byte for byte the  
original executable, its just been moved somewhere else and as far  
as I'm aware, code signatures do not include your location on disk.


You check the signature of the .app bundle, not the executable itself.

Charles
___

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

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

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

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


RE: Code Sign verification on Leopard

2009-10-14 Thread Jeff Laing
> Actually, heck, you wouldn't even need that. All a virus would have to
> do would be to move the binary somewhere else and put a binary in its
> place that does something malicious and then launches the real binary,
> and the user would never tell the difference.
> 
> Unless, of course, the app checked its code signature.

Ok, I'll bite.  How does the real binary checking its code signature detect the 
case you just described? Its 100% byte for byte the original executable, its 
just been moved somewhere else and as far as I'm aware, code signatures do not 
include your location on disk.

___

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: Code Sign verification on Leopard

2009-10-14 Thread Charles Srstka

On Oct 14, 2009, at 10:50 AM, Clark Cox wrote:


You say that as if "getting infected by" and "being specifically
targeted by" a virus are different things. Either a virus has targeted
your application, and as such knows enough about it to modify it's
code (and therefore replace/defeat any signature check), or it's
targeting something outside of your application (a framework, a bundle
loaded into your application, etc.), in which case the changed code
happens outside of your application's code and a signature check will
not find any issues.

If you're trying to detect malicious changes to your application, then
checking your own signature is useless, the entity doing the check has
to be beyond the reach of the malicious code in order to be trusted;
once that check is inside the application code itself, it becomes
useless.


Back in the old days when Macs had a fair number of viruses, a number  
of them used to insert themselves into the code of every application  
on the system. An early example of this was nVIR, which infected every  
application it encountered with its own viral code, without knowing  
anything about the application itself. It worked by patching the jump  
table in the CODE 0 resource, so that particular method wouldn't work  
on OS X, but I'm sure that with a sufficient knowledge of the  
structure of the Mach-O format and of Intel assembly, one could do  
something similar.


Actually, heck, you wouldn't even need that. All a virus would have to  
do would be to move the binary somewhere else and put a binary in its  
place that does something malicious and then launches the real binary,  
and the user would never tell the difference.


Unless, of course, the app checked its code signature.

Charles
___

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

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

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

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


Re: shared preferences.

2009-10-14 Thread Jens Alfke


On Oct 14, 2009, at 8:38 PM, Sandro Noel wrote:

I'm experiencing problems with my application preference, some part  
of the preferences are user specific but the licensing part is meant  
to be global for the computer. I am looking for a document that  
would explain how I can get some preferences installed in /Library


NSUserDefaults doesn't have an API for all-users-on-this-machine  
prefs, but CFPreferences, which it's based on, does.


—Jens___

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

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

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

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


Re: iPhone/iPod Device Detection Necessary for App Approval?

2009-10-14 Thread David Duncan

On Oct 14, 2009, at 7:51 PM, Anthony Smith wrote:

My app is iPhone only. I'm curious as to whether I need do a device  
check at the beginning of my app's execution and disable the app in  
some way(have a view stating, "This app is iPhone only") in order to  
be accepted by the app store.


As Clark mentioned, if your application is iPhone only, then you  
should say so when you submit. If your using a 3.0 or later SDK (which  
you should) then the primary means to do this is via the  
UIRequiredDeviceCapabilities property list key (see  for more info).


I understand the importance of designing my app to detect what  
features are available on the device but if my app requires an  
iPhone and everything else is standard first gen, do I need to  
handle my app being installed on an iPod?



If there is truly no way that your application is useful on an iPod  
touch, then definitely state it is for iPhone only. But more  
importantly, you are really saying that your application is only  
useful if particular features exist. For example, requiring OpenGL ES  
2.0 would have restricted you to iPhone 3GS a few months ago, but now  
you can also run on the higher end iPod touches. Keeping that in mind  
means that your application will just run everywhere that the hardware  
it requires is available, rather than artificially only running on  
devices that you think have the features you need.

--
David Duncan
Apple DTS Animation and Printing

___

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


shared preferences.

2009-10-14 Thread Sandro Noel

Hello,

I'm experiencing problems with my application preference, some part of  
the preferences are user specific but the licensing part is meant to  
be global for the computer.
I am looking for a document that would explain how I can get some  
preferences installed in /Library or if someone could suggest a better  
place to store license information I'l willing to try anything out  
just as long as all users can have access to it even if not admin level.


thank you!


Sandro Noël
sandro.n...@mac.com
Mac OS X : Swear by your computer, not at it.
-Pensez vert! avant d’imprimer ce courriel.
-Go Green! please consider the environment before printing this email.





___

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: [SOLVED] Re: Help with NSURLConnection memory fault

2009-10-14 Thread Jens Alfke


On Oct 14, 2009, at 7:43 PM, Stuart Malin wrote:

Just a "lucky" coincidence that the memory where the dealloc'd  
NSURLConnection had lived was still the (now defunct) object, so it  
went through its motions again, and tried to release the delegate a  
second time.


The MallocScribble environment variable will help avoid that sort of  
"luck", by filling all deleted blocks with 0x55. I always set it in  
the executable inspector in any project I'm working on.


—Jens___

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

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

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

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


Re: iPhone/iPod Device Detection Necessary for App Approval?

2009-10-14 Thread Anthony Smith

Thanks for the response, David.

My app is iPhone only. I'm curious as to whether I need do a device  
check at the beginning of my app's execution and disable the app in  
some way(have a view stating, "This app is iPhone only") in order to  
be accepted by the app store.


I understand the importance of designing my app to detect what  
features are available on the device but if my app requires an iPhone  
and everything else is standard first gen, do I need to handle my app  
being installed on an iPod?


On Oct 14, 2009, at 12:42 PM, David Duncan wrote:


On Oct 14, 2009, at 7:29 AM, Anthony Smith wrote:

I read on a forum somewhere that it's necessary to detect the  
device your app is running on and enable/disable features  
accordingly (e.g. disable phone feature on iPod) for app approval.  
If an app is meant for the iPhone only, is it necessary to detect  
the device and notify the user?


If your application takes advantage of special features of a  
particular device then it is good UI to hide or disable those  
features when they are not available. How you do this will vary  
depending on exactly what you are trying to detect. For example, if  
you want to check for a camera, UIImagePickerController has methods  
that allow you to determine if one exists and what types of media it  
can handle.


If you could explain what you are trying to detect, I'm sure folks  
could point you where you need to look.

--
David Duncan
Apple DTS Animation and Printing





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

[SOLVED] Re: Help with NSURLConnection memory fault

2009-10-14 Thread Stuart Malin


On Oct 14, 2009, at 7:24 PM, Jens Alfke wrote:

It looks as though your object (the delegate) got dealloced too  
early, before the NSURLConnection finished loading. This shouldn't  
be possible, since the connection object retains the delegate, but  
you may have too many release calls to it someplace.


What I would do next is set a breakpoint in your class's dealloc  
method, and also in its -connectionDidFinishLoading: and - 
connection:didFailWithError:, and see which gets called first.


Thanks for the reply, Jens.  As I suspected, the time sequence  
ordering of the releases was just fine. The problem was releasing the  
NSURLConnection object twice, once when the connection had concluded,  
and again when the object that had created it was dealloc'ing (because  
I hadn't nil'd the pointer to the connection object after releasing  
it). Just a "lucky" coincidence that the memory where the dealloc'd  
NSURLConnection had lived was still the (now defunct) object, so it  
went through its motions again, and tried to release the delegate a  
second time.




___

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: Property List Format vs NSKeyedArchiver Format

2009-10-14 Thread Ken Ferry
On Wed, Oct 14, 2009 at 7:47 AM, Michael Ash  wrote:

> On Tue, Oct 13, 2009 at 6:24 PM, Ken Ferry  wrote:
> > Nor is there anything stopping you from dropping in classes written by
> > someone else.  You could use
> > MAKeyedArchiver.
> >  As long as the source is in your app, you control the format.
>


> In short: MAKeyedArchiver is probably instructive, and may even be a
> good base to start with when creating your own, but please don't use
> it as-is.


Okay, well, if you don't feel like fixing up MAKeyedArchver, you could take
a look at the archivers in the Cocotron project.

http://cocotron.googlecode.com/svn/trunk/Foundation/NSKeyedArchiving/

These are probably trying to use the same on-disk format as Cocoa's version.
 You don't need to rely on that, though.

-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: Can I make custom pasteboard type for an object reference?

2009-10-14 Thread Rick Mann


On Oct 14, 2009, at 17:43:28, mmalc Crawford wrote:



On Oct 14, 2009, at 5:21 PM, Rick Mann wrote:


  NSMutableData* data = [NSMutableData data];
  [data appendBytes: &self length: sizeof (self)];


Try using an NSValue:

+ (NSValue *)valueWithPointer:(const void *)aPointer
archive
then
unarchive
- (void *)pointerValue


Results in

"cannot encode (void *) value: "

Seems like I have to use an NSPasteboardItem.



___

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: Can I make custom pasteboard type for an object reference?

2009-10-14 Thread Kiel Gillard

A few other alternatives come to mind:
- archive an identifier value that uniquely identifies the object you  
are dragging or
- use and archive an instance of NSValue using the valueWithPointer:  
initializer.





NSValue conforms to the NSCoding protocol, you should be able to use  
NSKeyedArchiver to archive an instance of NSValue, write the archive  
to the pasteboard and unarchive it at your dragging destination using  
NSKeyedUnarchiver.


Kiel

On 15/10/2009, at 11:35 AM, Rick Mann wrote:

That's the kind of thing I'm trying to avoid. There's no need to do  
that, since the drag is only within my app. I just want the drag  
receiver to have access to a *point* to the object, not a new copy  
of the object.


On Oct 14, 2009, at 17:34:06, Kiel Gillard wrote:

You could archive and unarchive your object as data using  
NSKeyedArchiver and NSKeyedUnarchiver.






Kiel

On 15/10/2009, at 11:21 AM, Rick Mann wrote:

I'm trying to implement a library like Interface Builder's. When  
the user drags an item out of the library and onto one of my  
custom views, it should instantiate an object and place it in the  
view accordingly.


I'm trying to implement the drag by writing to the pasteboard an  
NSData object I create that contains a reference to the object,  
like so:


- (BOOL)
collectionView: (NSCollectionView*) inCollectionView
 writeItemsAtIndexes: (NSIndexSet*) inIndices
 toPasteboard: (NSPasteboard*) inPasteboard
{
 MyObject* foo = self.myFoo;
 if (foo != nil)
 {
 [inPasteboard declareTypes: [NSArray arrayWithObject:  
kUTIMyObjectRef] owner: nil];

 [inPasteboard writeObjects: [NSArray arrayWithObject: plugIn]];

 return YES;
 }

 return NO;
}

In MyObject:

- (NSArray*)
writableTypesForPasteboard: (NSPasteboard*) inPasteboard
{
 static NSArray* types = nil;
 if (types == nil)
 {
 types = [NSArray arrayWithObjects: kUTIMyObjectRef, nil];
 }

 return types;
}

- (id)
pasteboardPropertyListForType: (NSString*) inType
{
 if ([inType isEqualToString: kUTIMyObjectRef])
 {
 NSMutableData* data = [NSMutableData data];
 [data appendBytes: &self length: sizeof (self)];
 return data;
 }

 return nil;
}

+ (NSArray*)
readableTypesForPasteboard: (NSPasteboard*) inPasteboard
{
 static NSArray* types = nil;
 if (types == nil)
 {
 types = [NSArray arrayWithObjects: kUTIMyObjectRef, nil];
 }

 return types;
}


But nowhere do I see a way to turn that NSData into an object  
reference, and I'm pretty sure I'm not implementing  
pasteboardPropertyListForType: correctly, anyway (I mimicked what  
I saw in the docs).


Am I just going about this all the wrong way?

TIA,
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:
http://lists.apple.com/mailman/options/cocoa-dev/kiel.gillard%40gmail.com

This email sent to kiel.gill...@gmail.com






___

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

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

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

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


Re: Can I make custom pasteboard type for an object reference?

2009-10-14 Thread Rick Mann


On Oct 14, 2009, at 17:43:28, mmalc Crawford wrote:



On Oct 14, 2009, at 5:21 PM, Rick Mann wrote:


  NSMutableData* data = [NSMutableData data];
  [data appendBytes: &self length: sizeof (self)];


Try using an NSValue:

+ (NSValue *)valueWithPointer:(const void *)aPointer
archive
then
unarchive
- (void *)pointerValue


"Instances of class NSConcreteValue not valid for NSPasteboard - 
writeObjects:.  The class NSConcreteValue does not implement the  
NSPasteboardWriting protocol."

___

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: Can I make custom pasteboard type for an object reference?

2009-10-14 Thread mmalc Crawford

On Oct 14, 2009, at 5:21 PM, Rick Mann wrote:

>NSMutableData* data = [NSMutableData data];
>[data appendBytes: &self length: sizeof (self)];
> 
Try using an NSValue:

+ (NSValue *)valueWithPointer:(const void *)aPointer
archive
then
unarchive
- (void *)pointerValue

mmalc

___

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: Can I make custom pasteboard type for an object reference?

2009-10-14 Thread Rick Mann
That's the kind of thing I'm trying to avoid. There's no need to do  
that, since the drag is only within my app. I just want the drag  
receiver to have access to a *point* to the object, not a new copy of  
the object.


On Oct 14, 2009, at 17:34:06, Kiel Gillard wrote:

You could archive and unarchive your object as data using  
NSKeyedArchiver and NSKeyedUnarchiver.






Kiel

On 15/10/2009, at 11:21 AM, Rick Mann wrote:

I'm trying to implement a library like Interface Builder's. When  
the user drags an item out of the library and onto one of my custom  
views, it should instantiate an object and place it in the view  
accordingly.


I'm trying to implement the drag by writing to the pasteboard an  
NSData object I create that contains a reference to the object,  
like so:


- (BOOL)
collectionView: (NSCollectionView*) inCollectionView
  writeItemsAtIndexes: (NSIndexSet*) inIndices
  toPasteboard: (NSPasteboard*) inPasteboard
{
  MyObject* foo = self.myFoo;
  if (foo != nil)
  {
  [inPasteboard declareTypes: [NSArray arrayWithObject:  
kUTIMyObjectRef] owner: nil];

  [inPasteboard writeObjects: [NSArray arrayWithObject: plugIn]];

  return YES;
  }

  return NO;
}

In MyObject:

- (NSArray*)
writableTypesForPasteboard: (NSPasteboard*) inPasteboard
{
  static NSArray* types = nil;
  if (types == nil)
  {
  types = [NSArray arrayWithObjects: kUTIMyObjectRef, nil];
  }

  return types;
}

- (id)
pasteboardPropertyListForType: (NSString*) inType
{
  if ([inType isEqualToString: kUTIMyObjectRef])
  {
  NSMutableData* data = [NSMutableData data];
  [data appendBytes: &self length: sizeof (self)];
  return data;
  }

  return nil;
}

+ (NSArray*)
readableTypesForPasteboard: (NSPasteboard*) inPasteboard
{
  static NSArray* types = nil;
  if (types == nil)
  {
  types = [NSArray arrayWithObjects: kUTIMyObjectRef, nil];
  }

  return types;
}


But nowhere do I see a way to turn that NSData into an object  
reference, and I'm pretty sure I'm not implementing  
pasteboardPropertyListForType: correctly, anyway (I mimicked what I  
saw in the docs).


Am I just going about this all the wrong way?

TIA,
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:
http://lists.apple.com/mailman/options/cocoa-dev/kiel.gillard%40gmail.com

This email sent to kiel.gill...@gmail.com




___

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

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

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

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


Re: Can I make custom pasteboard type for an object reference?

2009-10-14 Thread Kiel Gillard
You could archive and unarchive your object as data using  
NSKeyedArchiver and NSKeyedUnarchiver.






Kiel

On 15/10/2009, at 11:21 AM, Rick Mann wrote:

I'm trying to implement a library like Interface Builder's. When the  
user drags an item out of the library and onto one of my custom  
views, it should instantiate an object and place it in the view  
accordingly.


I'm trying to implement the drag by writing to the pasteboard an  
NSData object I create that contains a reference to the object, like  
so:


- (BOOL)
collectionView: (NSCollectionView*) inCollectionView
   writeItemsAtIndexes: (NSIndexSet*) inIndices
   toPasteboard: (NSPasteboard*) inPasteboard
{
   MyObject* foo = self.myFoo;
   if (foo != nil)
   {
   [inPasteboard declareTypes: [NSArray arrayWithObject:  
kUTIMyObjectRef] owner: nil];

   [inPasteboard writeObjects: [NSArray arrayWithObject: plugIn]];

   return YES;
   }

   return NO;
}

In MyObject:

- (NSArray*)
writableTypesForPasteboard: (NSPasteboard*) inPasteboard
{
   static NSArray* types = nil;
   if (types == nil)
   {
   types = [NSArray arrayWithObjects: kUTIMyObjectRef, nil];
   }

   return types;
}

- (id)
pasteboardPropertyListForType: (NSString*) inType
{
   if ([inType isEqualToString: kUTIMyObjectRef])
   {
   NSMutableData* data = [NSMutableData data];
   [data appendBytes: &self length: sizeof (self)];
   return data;
   }

   return nil;
}

+ (NSArray*)
readableTypesForPasteboard: (NSPasteboard*) inPasteboard
{
   static NSArray* types = nil;
   if (types == nil)
   {
   types = [NSArray arrayWithObjects: kUTIMyObjectRef, nil];
   }

   return types;
}


But nowhere do I see a way to turn that NSData into an object  
reference, and I'm pretty sure I'm not implementing  
pasteboardPropertyListForType: correctly, anyway (I mimicked what I  
saw in the docs).


Am I just going about this all the wrong way?

TIA,
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:
http://lists.apple.com/mailman/options/cocoa-dev/kiel.gillard%40gmail.com

This email sent to kiel.gill...@gmail.com


___

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

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

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

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


Can I make custom pasteboard type for an object reference?

2009-10-14 Thread Rick Mann
I'm trying to implement a library like Interface Builder's. When the  
user drags an item out of the library and onto one of my custom views,  
it should instantiate an object and place it in the view accordingly.


I'm trying to implement the drag by writing to the pasteboard an  
NSData object I create that contains a reference to the object, like so:


- (BOOL)
collectionView: (NSCollectionView*) inCollectionView
writeItemsAtIndexes: (NSIndexSet*) inIndices
toPasteboard: (NSPasteboard*) inPasteboard
{
MyObject* foo = self.myFoo;
if (foo != nil)
{
[inPasteboard declareTypes: [NSArray arrayWithObject:  
kUTIMyObjectRef] owner: nil];

[inPasteboard writeObjects: [NSArray arrayWithObject: plugIn]];

return YES;
}

return NO;
}

In MyObject:

- (NSArray*)
writableTypesForPasteboard: (NSPasteboard*) inPasteboard
{
static NSArray* types = nil;
if (types == nil)
{
types = [NSArray arrayWithObjects: kUTIMyObjectRef, nil];
}

return types;
}

- (id)
pasteboardPropertyListForType: (NSString*) inType
{
if ([inType isEqualToString: kUTIMyObjectRef])
{
NSMutableData* data = [NSMutableData data];
[data appendBytes: &self length: sizeof (self)];
return data;
}

return nil;
}

+ (NSArray*)
readableTypesForPasteboard: (NSPasteboard*) inPasteboard
{
static NSArray* types = nil;
if (types == nil)
{
types = [NSArray arrayWithObjects: kUTIMyObjectRef, nil];
}

return types;
}


But nowhere do I see a way to turn that NSData into an object  
reference, and I'm pretty sure I'm not implementing  
pasteboardPropertyListForType: correctly, anyway (I mimicked what I  
saw in the docs).


Am I just going about this all the wrong way?

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

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


Re: SelectedRowIndexes

2009-10-14 Thread Kyle Sluder
On Wed, Oct 14, 2009 at 4:45 PM, gMail.com  wrote:
> I need that because the last object selected is the one I represent in the
> Inspector panel (instead of "Multiple Selection" which is not editable). So
> for example the last object selected has coords x = 30 and y = 50
> and I show these coords on the Inspector.

In that case, you will probably be best served by binding your table
view's selectedRowIndexes property to a property on your controller,
and having your controller expose a separate property that your
inspector uses to determine the object to inspect.  You could
implement the set delta KVC methods on your controller properties to
make your life easier.  In the event of multiple things really being
selected at once (think Cmd-A), you will still need to make an
arbitrary choice.

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

2009-10-14 Thread gMail.com
I need that because the last object selected is the one I represent in the
Inspector panel (instead of "Multiple Selection" which is not editable). So
for example the last object selected has coords x = 30 and y = 50
and I show these coords on the Inspector.

This info lets me do so nice tasks. e.g:
With all the objects selected, and the last object selected being
represented on the Inspector panel (x = 30), I can enter a value X = 35 then
all the objects will be translated by X = 5.

To do that I have to know what the user really selected as last.
I noticed that if I select a row with "byExtendingSelection:YES", I can
retrieve the last selected row with selectedRow.
But with selectRowIndexes:indexSet byExtendingSelection:NO
I lose the last selected row. This is (even) the case of deselecting a row
programmatically because there is not an API like
deselectRowIndexes:indexSet
To deselect programmatically I have to remove the indexRow from the indexSet
and call selectRowIndexes:indexSet byExtendingSelection:NO
so I lose the last selected row.

I could try to use an NSArrayController.

--
LL




> Da: Kyle Sluder 
> Data: Wed, 14 Oct 2009 09:44:00 -0700
> A: "gMail.com" 
> Cc: 
> Oggetto: Re: SelectedRowIndexes
> 
> On Wed, Oct 14, 2009 at 8:55 AM, gMail.com  wrote:
>> Instead I need to sort it as the selection order.
> 
> I'm kind of curious (not, I must emphasize, incredulous) as to why you
> need this.  Wouldn't it be better to record the order in which
> selections were made in the controller layer, not in the view?  You
> could bind selectionIndexes to a property on a controller that knows
> how to record selection history.
> 
> --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: Help with NSURLConnection memory fault

2009-10-14 Thread Jens Alfke
It looks as though your object (the delegate) got dealloced too early,  
before the NSURLConnection finished loading. This shouldn't be  
possible, since the connection object retains the delegate, but you  
may have too many release calls to it someplace.


What I would do next is set a breakpoint in your class's dealloc  
method, and also in its -connectionDidFinishLoading: and - 
connection:didFailWithError:, and see which gets called first.


—Jens___

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

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

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

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


Re: SelectedRowIndexes

2009-10-14 Thread Graham Cox


On 15/10/2009, at 10:01 AM, Peter Hudson wrote:

I have tackled this problem by using the NSTableView delegate  
method  tableViewSelectionDidChange:


In this method I query the table for selected rows and then compare  
with the index set from the previous call to
tableViewSelectionDidChange:   I simply store the incremental  
changes in sequence.



Like Kyle I'm curious about the rationale for this. Since there's no  
indication of how time played its part in coming up with the  
selection, doesn't this lead to strange behaviour for the user? What  
if I made a selection, got interrupted and only got back to work  
several hours later? How would what happened next make sense given  
that I'd almost certainly forgotten the selection sequence and had no  
feedback to remind me? Or does the selection get reflected in a second  
list that shows the sequence? That would make more sense but a pure  
selection with a hidden time element seems like a problematic UI to me.


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

2009-10-14 Thread Peter Hudson
I have tackled this problem by using the NSTableView delegate method   
tableViewSelectionDidChange:


In this method I query the table for selected rows and then compare  
with the index set from the previous call to
tableViewSelectionDidChange:   I simply store the incremental changes  
in sequence.


Peter
___

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

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

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

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


Re: Question about Apple's updated Sketch-112 program

2009-10-14 Thread Graham Cox


On 15/10/2009, at 12:44 AM, Michael de Haan wrote:


- (void)invalidateGraphic:(SKTGraphic *)graphic {
   NSArray *windowControllers = [self windowControllers];
[windowControllers makeObjectsPerformSelector:@selector 
(invalidateGraphic:) withObject:graphic];}
I **think** I see what each line is doing, but, fail to grasp the  
overall essence of the call.



When a graphic is inserted into the data model, the view that displays  
it must be updated so that it gets drawn. Since there can be multiple  
window controllers each having one or more views of the data model,  
this call ensures that they all get the message. I haven't checked but  
I suspect if you follow the trail of where -invalidateGraphic: goes,  
it ends up calling -setNeedsDisplayInRect: on a view somewhere.


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


Help with NSURLConnection memory fault

2009-10-14 Thread Stuart Malin

I create (in an object) an NSURLConnection and start it asynchronously:

	mNSURLConnection = [[NSURLConnection alloc]  
initWithRequest:urlRequest delegate:self];

[mNSURLConnection start];

I release the NSURLConnection instance after it calls back in
 -connectionDidFinishLoading:
 -connection:didFailWithError:

My code proceeds on its merry way, eventually releasing a bunch of  
objects, one of which was object that created the NSURLConnection  
instance (and had set itself as the delegate for that connection).   
Alas, when that object is deallocated, the app crashes (since I am  
running in Xcode, gdb is attached), and the stack trace shows:


#0  0xa078900c in objc_assign_ivar
#1	0x92a64558 in -[NSURLConnection(NSURLConnectionReallyInternal)  
releaseDelegate]

#2  0x92a644e4 in _NSURLConnectionReleaseClient
#3  0x902cbc4d in ClientContextHolder::forget
#4  0x902ca3f6 in URLConnectionClient::processEvents
...

I don't know what to make of this, other than I know that the delegate  
object is already deallocated. But, the NSURLConnection object was  
also, and earlier, so I don't understand why it appears to still  
exist, especially so late, and is still referring to its delegate.


I'd appreciate any advice about what I should go looking after to  
track this down, as I am reasonably certain that the sequence of my  
object deallocations is proper (based upon NSLog() calls in the - 
dealloc methods).



___

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: Setting Application cursor

2009-10-14 Thread Kyle Sluder
On Wed, Oct 14, 2009 at 2:56 PM, David Alter  wrote:
> I do need the cursor to be active everywhere on the screen. In other places
> we are using NSTrackingArea and that works great.

«Obligatory confirmation that you are doing this for good (ex:
eyedropper) and not for evil (well of course the user wants our
corsshair everywhere!).»

Maybe create a transparent window that overlays the entire screen and
use that to generate your tracking rect events?

--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: Setting Application cursor

2009-10-14 Thread David Alter
I do need the cursor to be active everywhere on the screen. In other places
we are using NSTrackingArea and that works great.

On Wed, Oct 14, 2009 at 2:48 PM, Kyle Sluder  wrote:

> On Wed, Oct 14, 2009 at 2:42 PM, David Alter 
> wrote:
> > I need to set a cursor for the application when it is in specific states.
> I
> > have been doing this by creating by cursor and calling set.
>
> Do you need this cursor to be effective anywhere on the screen?  If
> not, use the NSTrackingArea API on whatever view you want to have the
> custom cursor.  This is what we do in OmniGraphSketcher (well, we
> don't use NSTrackingArea, but instead the older tracking rect event
> API, but the result is the same).
>
> --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: Setting Application cursor

2009-10-14 Thread Kyle Sluder
On Wed, Oct 14, 2009 at 2:42 PM, David Alter  wrote:
> I need to set a cursor for the application when it is in specific states. I
> have been doing this by creating by cursor and calling set.

Do you need this cursor to be effective anywhere on the screen?  If
not, use the NSTrackingArea API on whatever view you want to have the
custom cursor.  This is what we do in OmniGraphSketcher (well, we
don't use NSTrackingArea, but instead the older tracking rect event
API, but the result is the same).

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


Setting Application cursor

2009-10-14 Thread David Alter
I need to set a cursor for the application when it is in specific states. I
have been doing this by creating by cursor and calling set.

[[NSCursor crosshairCursor] set];

If the application is deactivated. When you activate the application the
cursor needs to be reset. I tried doing this in
NSApplicationDidBecomeActiveNotification and that is not working. I suspect
it is getting set but then it is getting set back to the pointer. Any
suggestions on when I should set this after my application becomes active.

thanks for the help
-dave
___

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: Positioning NSWindow center to Application main window?

2009-10-14 Thread Jens Alfke


On Oct 14, 2009, at 2:09 PM, Arun wrote:


Is it possible to position the launched window to become exactly
center to the Main application window?


Get the frame of the main window. Get the frame of your new window.  
Figure out how far to offset the x,y of the new window's frame to  
center it. Set its frame to that.


—Jens___

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

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

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

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


Re: AudioConverterFillComplexBuffer problem in Snow Leopard

2009-10-14 Thread Kyle Sluder
On Wed, Oct 14, 2009 at 2:05 PM, Bill Patterson  wrote:
> When trying to convert a Apple Lossless audio file (.m4a) to a aif file on
> Snow Leopard 10.6.1, I get an error return value from
> AudioConverterFillComplexBuffer() with an ascii value of '!dat', 0x21646174.

Looks like you meant to post this to coreaudio-api instead.

--Kyle Sluder
___

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

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

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

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


Positioning NSWindow center to Application main window?

2009-10-14 Thread Arun
Hi
In my application, i launch a window on a click of button.
Is it possible to position the launched window to become exactly
center to the Main application window?
If so how can i achieve this.

Thanks
Arun KA
___

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


AudioConverterFillComplexBuffer problem in Snow Leopard

2009-10-14 Thread Bill Patterson
When trying to convert a Apple Lossless audio file (.m4a) to a aif  
file on Snow Leopard 10.6.1, I get an error return value from  
AudioConverterFillComplexBuffer() with an ascii value of '!dat',  
0x21646174.


The error is returned the initial time the routine is called, before  
any conversion has taken place.   Other file formats convert OK on  
10.6.1.


This same code and audio file works fine on 10.5.7 with QuickTime 7.6.2.

Does anybody have any ideas what this could be?

Thanks,

Bill Patterson
___

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: Handle multiple screens & mouse

2009-10-14 Thread Jens Alfke


On Oct 14, 2009, at 12:53 AM, Gabriel Höhener wrote:

The problem is not about the window but about the mouse. When i  
programmatically move the mouse around and cross the borders of my  
screens, it jumps to (0,0) on the mainscreen..


Don't move the mouse cursor around! That's just annoying. No good Mac  
software does this.


—Jens___

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

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

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

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


Slider with tag?

2009-10-14 Thread Gabriel Zachmann
Could someone please explain to me how I can present a little tag to  
the user that moves along with a slider's handle (above or below), in  
which I can give some feedback to the user about the current value of  
the slider?


I'm afraid I couldn't find an example, but I think I have seen such a  
thing somewhere ...


Thanks a lot in advance.

Best regards,
Gabriel.



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

Re: CoreData could not fulfill a fault after Save As

2009-10-14 Thread Jim Thomason
On Wed, Oct 14, 2009 at 2:25 PM, Ben Trumbull  wrote:
>> The short description is this - I have a document based CoreData app.
>> I can carefully craft a set of data. I then open the document, select
>> a particular record, and do a Save As. This works fine. But when I
>> select a second record, I get errors that CoreData could not fulfill a
>> fault. If I quit the app and re-launch it, I can operate on the copy I
>> just saved w/o issue, so apparently the data is there. I haven't a
>> clue what the problem is.
>
> Does your app run correctly on 10.5.* ?  There's a known regression similar
> to this in 10.6.0 and 10.6.1.
>
> If this reproduces on a system other than 10.6.0 or 10.6.1, please file a
> bug.

Thank you, that was the puzzle piece I was missing. I was indeed
running on 10.6.1. I deployed over to my other box running 10.5.8 and
set up  an identical test. No problems whatsoever.

So I'll stop banging my head against the wall and sit back and wait
for the bugfix.

-Jim
___

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


Intercept tap on URL in UITextView

2009-10-14 Thread Lorenzo Thurman
I have text in a UITextView which *may* contain a URL. I would like to
intercept any tap on the URL and display the html page in an UIWebView in my
app. Can anyone point me to some sample code that does this? Or is it even
possible?Thanks!

-- 
"My break-dancing days are over, but there's always the funky chicken"
--The Full Monty
___

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: Default Core Data errors

2009-10-14 Thread Rick Mann
I did exactly that for readFromURL. It comes back with no errors. The  
dialog is not displayed until after that method returns.


I'll try the configure call.

On Oct 14, 2009, at 12:31:28, Ben Trumbull wrote:



On Oct 14, 2009, at 12:21 PM, Rick Mann wrote:

In the simplest case, I don't create any entities. I don't override  
any of NSPersistentDocument's persistence-related methods. I just  
save the new untitled document, then try to re-open it.


You can override the methods declared in NSPersistentDocument.h  
particularly configurePersistentStoreCoordinatorForURL and  
readFromURL, and just call super.  But look at the BOOL result and  
if NO, the NSError.


You can also grab the error in the debugger as others have suggested.

- Ben





___

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

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

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

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


Re: Default Core Data errors

2009-10-14 Thread Ben Trumbull


On Oct 14, 2009, at 12:21 PM, Rick Mann wrote:

In the simplest case, I don't create any entities. I don't override  
any of NSPersistentDocument's persistence-related methods. I just  
save the new untitled document, then try to re-open it.



You can override the methods declared in NSPersistentDocument.h  
particularly configurePersistentStoreCoordinatorForURL and  
readFromURL, and just call super.  But look at the BOOL result and if  
NO, the NSError.


You can also grab the error in the debugger as others have suggested.

- Ben



___

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

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

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

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


re: CoreData could not fulfill a fault after Save As

2009-10-14 Thread Ben Trumbull

The short description is this - I have a document based CoreData app.
I can carefully craft a set of data. I then open the document, select
a particular record, and do a Save As. This works fine. But when I
select a second record, I get errors that CoreData could not fulfill a
fault. If I quit the app and re-launch it, I can operate on the copy I
just saved w/o issue, so apparently the data is there. I haven't a
clue what the problem is.


Does your app run correctly on 10.5.* ?  There's a known regression  
similar to this in 10.6.0 and 10.6.1.


If this reproduces on a system other than 10.6.0 or 10.6.1, please  
file a bug.


- Ben

___

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

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

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

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


Re: Default Core Data errors

2009-10-14 Thread Rick Mann
In the simplest case, I don't create any entities. I don't override  
any of NSPersistentDocument's persistence-related methods. I just save  
the new untitled document, then try to re-open it.


On Oct 14, 2009, at 12:11:29, Ben Trumbull wrote:

Do you check, and at least assert, if any API that has an NSError**  
parameter returns one ?  (typically a return value of NO or nil).   
For Core Data, you'll always want to check adding a store to the  
coordinator, saving, and fetching.  For your documented based app,  
the NSDocument APIs can also return errors.


When you get an NSError, you'll want to also log its userInfo  
dictionary.


- Ben



___

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

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

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

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


re: Default Core Data errors

2009-10-14 Thread Ben Trumbull
Do you check, and at least assert, if any API that has an NSError**  
parameter returns one ?  (typically a return value of NO or nil).  For  
Core Data, you'll always want to check adding a store to the  
coordinator, saving, and fetching.  For your documented based app, the  
NSDocument APIs can also return errors.


When you get an NSError, you'll want to also log its userInfo  
dictionary.


- Ben

___

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

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

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

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


Re: CALayer z-axis scale

2009-10-14 Thread douglas welton
Question:  does your view actually have a "depth" in the z dimension  
or is it just a plane with x and y measurement and a z (depth) of  
0.0.  If you scale something with a size of zero, you'll produce no  
visible results.  If you want the position of one layer to change,  
relative to another, you'll have to change the z coordinate, not scale  
it.


On Oct 14, 2009, at 1:45 PM, ChrisOutwin wrote:

My Core Animation application correctly scales a CALayer's x and y  
axes but does nothing to change the layer's visual position relative  
to sibling layers when the z scaling factor is changed in the UI.   
The debugger and NSLog both indicate that element m33 of the  
CATransform3D structure change to reflect the value from the UI.   
Setting element m34 to 1.0 / -850 to create a perspective transform  
does nothing.


I've carefully read the Layer Geometry and Transformation section  
of  the Core Animation Programming Guide.  The only example I've  
found (CALayerExample) uses CATransform3DMakeScale, but sets 1.0 as  
the argument for the z-axis parameter.  (When I edited this example  
code to make all of the arguments the same,  the CALayer did not  
change on the z-axis.)


Is there an example which scales a CALayer on the z-axis?  I've  
worked for two days trying to get this.  What am I missing?


Thank you very much.

Chris Outwin


___

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: Default Core Data errors

2009-10-14 Thread Rick Mann
Well, I discovered the willPresentError delegate method. From that, I  
got:


(gdb) po inError
Error Domain=NSCocoaErrorDomain Code=256 UserInfo=0x200272ea0 "The  
document “Untitled.telem” could not be opened. "

(gdb) po [inError userInfo]
{
NSLocalizedDescription = "The document \U201cUntitled.telem\U201d  
could not be opened. ";

}


Not particularly helpful. I wonder if there's some non-Core Data,  
fundamental doc-handling thing going on here.



On Oct 14, 2009, at 10:38:47, Kyle Sluder wrote:

On Wed, Oct 14, 2009 at 10:30 AM, Rick Mann   
wrote:
Is there a way I can get at that programmatically, rather than via  
gdb? I'm

very clumsy in gdb.


Your time will be better spent learning how to use the debugger.

Quick crash course:

1. Use `po` to print objects. Example:

po theError



2. Use regular ObjC syntax to call methods on objects.  Sometimes you
need to provide type information, because gdb doesn't have as much
information available to it as the compiler does.  Example:

po (id)[theError description]

"The document could not be opened."

3. Use the `call` command to call arbitrary functions, methods, etc.
Again, casting might be necessary.

call (void)NSLog(@"The error says: %@", (id)[theError description])

debugged-process[2134] 00:00:00 The error says: The document could not
be opened.

Of course, use the Debugger panel to select different stack frames,
which in turn affects what variables are in scope.

--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: Default Core Data errors

2009-10-14 Thread Rick Mann
I knew about po, but sometimes it says the thing is nil, but then I'll  
go back to my code and write NSLog() statements, and it prints  
something out, so I felt like po wasn't reliable. Also, when accessing  
collections, it was easier to write loops in ObjC.


But I'll give this a shot, thanks!

On Oct 14, 2009, at 10:38:47, Kyle Sluder wrote:

On Wed, Oct 14, 2009 at 10:30 AM, Rick Mann   
wrote:
Is there a way I can get at that programmatically, rather than via  
gdb? I'm

very clumsy in gdb.


Your time will be better spent learning how to use the debugger.

Quick crash course:

1. Use `po` to print objects. Example:

po theError



2. Use regular ObjC syntax to call methods on objects.  Sometimes you
need to provide type information, because gdb doesn't have as much
information available to it as the compiler does.  Example:

po (id)[theError description]

"The document could not be opened."

3. Use the `call` command to call arbitrary functions, methods, etc.
Again, casting might be necessary.

call (void)NSLog(@"The error says: %@", (id)[theError description])

debugged-process[2134] 00:00:00 The error says: The document could not
be opened.

Of course, use the Debugger panel to select different stack frames,
which in turn affects what variables are in scope.

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


CALayer z-axis scale

2009-10-14 Thread ChrisOutwin
My Core Animation application correctly scales a CALayer's x and y  
axes but does nothing to change the layer's visual position relative  
to sibling layers when the z scaling factor is changed in the UI.  The  
debugger and NSLog both indicate that element m33 of the CATransform3D  
structure change to reflect the value from the UI.  Setting element  
m34 to 1.0 / -850 to create a perspective transform does nothing.


I've carefully read the Layer Geometry and Transformation section of   
the Core Animation Programming Guide.  The only example I've found  
(CALayerExample) uses CATransform3DMakeScale, but sets 1.0 as the  
argument for the z-axis parameter.  (When I edited this example code  
to make all of the arguments the same,  the CALayer did not change on  
the z-axis.)


Is there an example which scales a CALayer on the z-axis?  I've worked  
for two days trying to get this.  What am I missing?


Thank you very much.

Chris Outwin



___

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: Default Core Data errors

2009-10-14 Thread Kyle Sluder
On Wed, Oct 14, 2009 at 10:30 AM, Rick Mann  wrote:
> Is there a way I can get at that programmatically, rather than via gdb? I'm
> very clumsy in gdb.

Your time will be better spent learning how to use the debugger.

Quick crash course:

1. Use `po` to print objects. Example:
>> po theError


2. Use regular ObjC syntax to call methods on objects.  Sometimes you
need to provide type information, because gdb doesn't have as much
information available to it as the compiler does.  Example:
>> po (id)[theError description]
"The document could not be opened."

3. Use the `call` command to call arbitrary functions, methods, etc.
Again, casting might be necessary.
>> call (void)NSLog(@"The error says: %@", (id)[theError description])
debugged-process[2134] 00:00:00 The error says: The document could not
be opened.

Of course, use the Debugger panel to select different stack frames,
which in turn affects what variables are in scope.

--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: Default Core Data errors

2009-10-14 Thread Volker in Lists
Rick,

you can use po and than most of what you are used in Obj-C like you would use 
in NSLog.

Or just use NSLog and any of the properties a NSError has.

Cheers,
Volker
Am 14.10.2009 um 19:30 schrieb Rick Mann:

> 
> On Oct 14, 2009, at 09:57:58, Kyle Sluder wrote:
> 
>> On Wed, Oct 14, 2009 at 9:44 AM, Rick Mann  wrote:
>>> Breaking on all -presentError:, it finally stops here:
>> 
>> Okay, this is the point at which you examine the NSError and see if it
>> has any more information for you. :)
> 
> Is there a way I can get at that programmatically, rather than via gdb? I'm 
> very clumsy in gdb.
> 

___

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

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

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

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


Re: Default Core Data errors

2009-10-14 Thread Rick Mann


On Oct 14, 2009, at 09:51:15, Volker in Lists wrote:


Rick,

which StoreType are you using? If it is XML it could be worth  
looking into the raw xml. Otherwise more information on the model  
and any special methods (if any) could be useful. Any changes to the  
standard CoreData template provided by Xcode?


Is the file readable at all from finder using a hex editor or any  
command line call that accesses the file content? Just to make sure  
it is not a problem at another level.


I changed it to XML to take a look, and it seems valid:






134481920
8258EA9F-50BF-47F5-9D50-926A679A3CAD
102



NSPersistenceFrameworkVersion
246
NSStoreModelVersionHashes

PlugInInstance

kyaLbHd5FsUZW4WHvHM86xum+H2tygpxb+UTc6dyIhQ=


NSStoreModelVersionHashesVersion
3
NSStoreModelVersionIdentifiers







___

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: Default Core Data errors

2009-10-14 Thread Rick Mann


On Oct 14, 2009, at 09:57:58, Kyle Sluder wrote:

On Wed, Oct 14, 2009 at 9:44 AM, Rick Mann   
wrote:

Breaking on all -presentError:, it finally stops here:


Okay, this is the point at which you examine the NSError and see if it
has any more information for you. :)


Is there a way I can get at that programmatically, rather than via  
gdb? I'm very clumsy in gdb.


___

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

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

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

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


NSTimeZone questions

2009-10-14 Thread Alex Kac
Some hopefully basic questions. We normally call [NSTimeZone  
localTimeZone] in our app to get the current timezone. In some cases  
we may set the default timezone via [NSTimeZone  
setDefaultTimeZone:...]. Now after we've done that we want to reset it  
so that it again simply gets the system's timezone. My assumption is to

[NSTimeZone setDefaultTimeZone:[NSTimeZone 
systemTimeZone]];

Does that sound right? Or should I pass nil and it'll know what to do?  
I've read the docs a few times and I can't seem to determine the  
correct answer to this one. I have also googled it, but NSTimeZone  
doesn't seem to be talked about much.




Alex Kac - President and Founder
Web Information Solutions, Inc.

"Patience is the companion of wisdom."
--Anonymous




___

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: iPhone/iPod Device Detection Necessary for App Approval?

2009-10-14 Thread Clark Cox
On Wed, Oct 14, 2009 at 7:29 AM, Anthony Smith
 wrote:
> I read on a forum somewhere that it's necessary to detect the device your
> app is running on and enable/disable features accordingly (e.g. disable
> phone feature on iPod) for app approval.

I can't speak to what's required for approval, but I would definitely
disable telephone only features when they are not available. Remember
this should not be a simple iPhone vs. iPod check; you should be
checking for the individual features as there may some day be an iPod
that has features now considered iPhone-specific (as has happened in
the past with external speakers, microphones, etc.) or there may be an
iPhone that is somehow more iPod-like.

Testing for individual features is a good way to future-proof yourself.

> If an app is meant for the iPhone
> only, is it necessary to detect the device and notify the user?

If you app absolutely requires an iPhone, then you should say so when
you submit your application to iTunesConnect. This will prevent the
end-user from even installing the app on an iPod touch.
-- 
Clark S. Cox III
clarkc...@gmail.com
___

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

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

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

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


CoreData could not fulfill a fault after Save As

2009-10-14 Thread Jim Thomason
I'm completely and utterly stumped. I've stumbled across a showstopper
bug and could use some pointers to try and debug it. Unfortuately, I
haven't been able to reduce it into a succinct demo app. So clearly,
the error is elsewhere in my code, but I can't figure out how to track
it down yet.

The short description is this - I have a document based CoreData app.
I can carefully craft a set of data. I then open the document, select
a particular record, and do a Save As. This works fine. But when I
select a second record, I get errors that CoreData could not fulfill a
fault. If I quit the app and re-launch it, I can operate on the copy I
just saved w/o issue, so apparently the data is there. I haven't a
clue what the problem is.

I'll try to explain in more detail.

Let's say that I have a group of machines. It doesn't matter what they
produce, just that they make something. Each machine can have multiple
operators, and each operator submits a job into the machine to use it
to produce whatever it makes.

The app just keeps track of that - for this machine, these operators
submitted those jobs. Nothing else.

Here's what happens - create a new document. This will automatically
create a single machine for you, since you need at least one.

Add two operators to it, Fred and Bob. Log that Bob submitted a job
("Make widgets").

Next, select Fred in the interface, and quit the app. Re-launch it and
re-open the document. It keeps track of the last operator selected, so
that one's selected in the interface. Note that Fred has not submitted
any jobs.

Next, do a save as on the document, and put it anywhere. The save
succeeds. Now, when I try to click on Bob to view his jobs, I get an
error that CoreData could not fulfill a fault. Some further research
indicated that the job record is actually there ("Make widgets"). The
problem is when the job record tries to access its operator. -That-
causes the 'could not fulfill a fault' error.

So I can see Bob in the interface, it's just when I click on him that
it tries to load his orders into another table. For display purposes,
that table also populates the name of the job's operator, and that's
where the thing blows up.


If I quit the app and re-open the document, I can select Bob and view
his jobs without complaint.

Further, if before I do the Save As, I select Bob, or otherwise view
him in any way, the error does not occur. I can do the Save As and
then re-select Bob without issue. It's only when Bob's orders haven't
been viewed in the original document that it breaks.


Inspection on the job entry shows that both the job and its operator
record both exist in the same managedObjectContext, which is the one
newly created for the document. Further, as best as I can tell, they
are newly created objects.

And I am also completely and utterly stumped as to what's causing this.

I know I haven't provided much info in terms of what the code's doing,
and I'm sure the problem is elsewhere, I just can't find it. Does
anyone have any ideas for what I can do to debug this issue and track
down the root cause? I've just been grasping at straws. Any pointers
for what I should look for, potential sources of this issue, or useful
methods to break on would be greatly appreciated.

Many thanks,

-Jim
___

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: Default Core Data errors

2009-10-14 Thread Kyle Sluder
On Wed, Oct 14, 2009 at 9:44 AM, Rick Mann  wrote:
> Breaking on all -presentError:, it finally stops here:

Okay, this is the point at which you examine the NSError and see if it
has any more information for you. :)

--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: Default Core Data errors

2009-10-14 Thread Volker in Lists
Rick,

which StoreType are you using? If it is XML it could be worth looking into the 
raw xml. Otherwise more information on the model and any special methods (if 
any) could be useful. Any changes to the standard CoreData template provided by 
Xcode? 

Is the file readable at all from finder using a hex editor or any command line 
call that accesses the file content? Just to make sure it is not a problem at 
another level. 

The stack trace does - at least for me - not reveal anything CoreData related 
that could be used as a starting point to dig into the problem more deeply. 

Volker

Am 14.10.2009 um 18:44 schrieb Rick Mann:

> 
> On Oct 14, 2009, at 09:34:20, Kyle Sluder wrote:
> 
>> On Wed, Oct 14, 2009 at 9:06 AM, Rick Mann  wrote:
>>> No exceptions (I checked "Stop on Objective-C Exceptions" and created a
>>> symbolic breakpoint on "objc_exception_throw" just to be sure).
>> 
>> Also try breaking on -[NSApp presentError:].

___

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: Object Alloc Instrument and releasing question

2009-10-14 Thread Shawn Erickson
On Tue, Oct 13, 2009 at 1:40 PM, Nick Rogers  wrote:


> Here is some Object Alloc instrument data after the first tree is formed
> (1), after releasing that tree (2) and after again making a tree (3):
>CategoryLive Bytes  #Living #Transitory
> Overall Bytes   #Overall
> 1.  HDIR1.73 MB 10333   10428
> 3.48 MB 20761
>

For this sample period Instruments saw a total of 20761 unique instances of
the HDIR class created (#Overall). At the end of the sample period of those
20761 instances that got created 10333 are still in existence (#Living)
while 10428 no longer exist (#Transitory). The 10333 still "living"
instances are continuing to consume 1.73 MB out of a total of 3.48 MB worth
of memory consumed by all instances seen (not all still living) during the
sample period.


> 2.  HDIR0   0
> 20761   3.48 MB 20761
>

At this point no instance of the HDIR class exist and no more got created
since (1).


> 3.  HDIR1.73 MB 10333   31189
> 6.97 MB 41522
>

At this point an additional 20761 instances of the HDR class got created for
a grand total of 41522 being created since you started sampling. Of the
20761 additional instances only 10333 continue to exist, etc.

I see no evidence of a leak here given that the "live" count and bytes goes
to zero in (2) which you say is related to when you release the tree.

-Shawn
___

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: Problem using filewrappers under snow leopard - SOLVED

2009-10-14 Thread Eagle Offshore
I thought I'd share the underlying cause.  In prior versions of OS X,  
if the contents of the file was nil, NSFileWrapper would just create  
an empty file.  No problem.  Empty file.


Under Snow Leopard, NSFileWrapper writing aborts cryptically if any of  
the files' contents are nil or the wrapper is empty.  My app allows  
the creation of optional rich text data to be saved with each "song"  
but if the user didn't touch the text editor, then it gives back nil  
rather than empty data.


Thus, - write failure.  Apparently we now have to check for nil data  
when creating a file wrapper even though this was OK before for the  
past couple OS versions.  Also, empty file wrappers don't work either  
but sticking one non-nil thing in works.  So, I've added a check for  
nil before adding an item to the wrapper.


Filed a bug 7302406


- (NSFileWrapper *)fileWrapperOfType:(NSString *)aType error: 
(NSError**)errPtr

{
int i, count = [_songs count];
NSFileWrapper* wrapper = [[NSFileWrapper alloc]  
initDirectoryWithFileWrappers:nil];	
[wrapper addRegularFileWithContents:[self setData]  
preferredFilename:@"Sets.plist"];


for(i = 0; i < count; ++i)
{
JBSong* song = [_songs objectAtIndex: i];
[wrapper addRegularFileWithContents: [song asData]  
preferredFilename: [[song fileName] stringByAppendingPathExtension:  
@"sng"]];

NSData* lyrics = [song lyricData];
if(lyrics)
{
[wrapper addRegularFileWithContents: [song lyricData]  
preferredFilename: [[song fileName] stringByAppendingPathExtension:  
@"rtf"]];

}
}
[wrapper addRegularFileWithContents:[NSKeyedArchiver  
archivedDataWithRootObject: _midiController]  
preferredFilename:@"Midi.map"];


return [wrapper autorelease];
}

-Todd Blanchard
___

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: Default Core Data errors

2009-10-14 Thread Rick Mann


On Oct 14, 2009, at 09:34:20, Kyle Sluder wrote:

On Wed, Oct 14, 2009 at 9:06 AM, Rick Mann   
wrote:
No exceptions (I checked "Stop on Objective-C Exceptions" and  
created a

symbolic breakpoint on "objc_exception_throw" just to be sure).


Also try breaking on -[NSApp presentError:].


Breaking on all -presentError:, it finally stops here:

#0  0x7fff86768ce5 in -[NSDocumentController presentError:]
#1	0x7fff8676b71d in -[NSDocumentController  
_finishBatchedOpeningAndPresentErrors:]
#2	0x7fff8676d341 in -[NSDocumentController  
_openDocumentsWithContentsOfURLs:display:presentErrors:]

#3  0x7fff8658c23e in -[NSApplication sendAction:to:from:]
#4  0x7fff865b078a in -[NSMenuItem _corePerformAction]
#5	0x7fff865b04f4 in -[NSCarbonMenuImpl  
performActionWithHighlightingForItemAtIndex:]

#6  0x7fff865961b1 in -[NSMenu performKeyEquivalent:]
#7  0x7fff86594f59 in -[NSApplication _handleKeyEquivalent:]
#8  0x7fff86465ce1 in -[NSApplication sendEvent:]
#9  0x7fff863fcacc in -[NSApplication run]
#10 0x7fff863f5798 in NSApplicationMain
#11 0x11aa5 in main at main.m:13



___

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

2009-10-14 Thread Kyle Sluder
On Wed, Oct 14, 2009 at 8:55 AM, gMail.com  wrote:
> Instead I need to sort it as the selection order.

I'm kind of curious (not, I must emphasize, incredulous) as to why you
need this.  Wouldn't it be better to record the order in which
selections were made in the controller layer, not in the view?  You
could bind selectionIndexes to a property on a controller that knows
how to record selection history.

--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: iPhone/iPod Device Detection Necessary for App Approval?

2009-10-14 Thread David Duncan

On Oct 14, 2009, at 7:29 AM, Anthony Smith wrote:

I read on a forum somewhere that it's necessary to detect the device  
your app is running on and enable/disable features accordingly (e.g.  
disable phone feature on iPod) for app approval. If an app is meant  
for the iPhone only, is it necessary to detect the device and notify  
the user?


If your application takes advantage of special features of a  
particular device then it is good UI to hide or disable those features  
when they are not available. How you do this will vary depending on  
exactly what you are trying to detect. For example, if you want to  
check for a camera, UIImagePickerController has methods that allow you  
to determine if one exists and what types of media it can handle.


If you could explain what you are trying to detect, I'm sure folks  
could point you where you need to look.

--
David Duncan
Apple DTS Animation and Printing

___

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: Zombies instrument for iPhone?

2009-10-14 Thread Nick Zitzmann


On Oct 14, 2009, at 10:09 AM, Jon Drukman wrote:

I have been playing around with Instruments trying to get it to run  
my app in the simulator with zombies enabled and I can't quite  
figure out the sequence of steps required to make it happen.  Do you  
happen to have a recipe?


Xcode won't let me select Zombies as an instrument, even when the  
target is set to Simulator.


Don't use Xcode to launch Instruments. Launch Instruments and set  
things up manually; you'll find there's a zombie instrument there you  
can choose when you look at simulator instruments.


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

2009-10-14 Thread Corbin Dunn

On Oct 14, 2009, at 8:55 AM, gMail.com wrote:

> Hi,
> when I call [tableView selectedRowIndexes];
> I always get a indexSet already sorted by row.
> Instead I need to sort it as the selection order.
> I mean, if the user selected the rows in the order
> 
> Row 6
> Row 2 
> Row 8
> 
> I want to get 6, 2, 8 and not 2, 6, 8 as I get now with selectedRowIndexes.
> How can I do that?


You can't. Please log a bug requesting this ability (I have heard of more than 
one person wanting this). 

Well, you could do it yourself with heavy subclassing of NSTableView and 
overriding the -selectRow type of methods and keeping track of the order 
yourself.

corbin

___

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: Default Core Data errors

2009-10-14 Thread Kyle Sluder
On Wed, Oct 14, 2009 at 9:06 AM, Rick Mann  wrote:
> No exceptions (I checked "Stop on Objective-C Exceptions" and created a
> symbolic breakpoint on "objc_exception_throw" just to be sure).

Also try breaking on -[NSApp presentError:].

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


[SOLVED] Re: Question about Apple's updated Sketch-112 program

2009-10-14 Thread Michael de Haan






and the part that I do not get:

- (void)invalidateGraphic:(SKTGraphic *)graphic {
   NSArray *windowControllers = [self windowControllers];
[windowControllers makeObjectsPerformSelector:@selector 
(invalidateGraphic:) withObject:graphic];}
I **think** I see what each line is doing, but, fail to grasp the  
overall essence of the call.

Thanks in advance.




Despite the fact that this is the latest version of Xcode, somehow the  
old examples were not replaced. This call, thus, I believe is from  
the  **old** version of sketch. 
___


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

2009-10-14 Thread I. Savant

On Oct 14, 2009, at 11:55 AM, gMail.com wrote:

  Oh, come on, at least pick a witty pseudonym. :-D



when I call [tableView selectedRowIndexes];
I always get a indexSet already sorted by row.
Instead I need to sort it as the selection order.
I mean, if the user selected the rows in the order

Row 6
Row 2
Row 8

I want to get 6, 2, 8 and not 2, 6, 8 as I get now with  
selectedRowIndexes.

How can I do that?


  You can't. Not with -selectedRowIndexes. As you said, it returns an  
NSIndexSet. Sets are unordered by nature. Not in the sense you're  
looking for. They're kept internally as an ascending-order list for  
efficiency.


  You're going to have to track changes in selection yourself  
(examine the NSTableView API - there are methods to help you with this).


  Also consider a few scenarios that will affect "the selection order":

1 - Click the third row, shift-click the seventh row. Now the  
selection index set is now {2, 3, 4, 5, 6}.


2 - With that last result, command-click row 3, then, 4, then 3 again.  
The selection set is now {2, 3, 5, 6}.


3 - Click row 7, shift-click row 6, then Cmd-click row 8. Selection is  
now {5, 6, 7}.


  Considering these scenarios, what would your selection order be in  
each? What about combining them? Selection can go in many directions  
and things can be added and removed to/from anywhere in the set. Think  
carefully - getting this basic behavior wrong has the potential to  
annoy users.



Please note that I can select the rows even programmatically,  
because the

user selects an object on the canvas.


  Same as above - you'll have to track the order. I'd make a table  
view subclass and override (calling super, then my custom code) the  
selection-changing methods, then provide a separate selection-getting  
routine (to provide an ordered array of indexes) called  
"orderedSelection" or something similar. This gives you one central  
place for user- or code-initiated selection changes.


--
I.S.


___

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: Zombies instrument for iPhone?

2009-10-14 Thread Jon Drukman
On Tue, Oct 13, 2009 at 8:32 PM, Nick Zitzmann  wrote:

>
> On Oct 13, 2009, at 5:35 PM, Jon Drukman wrote:
>
>  Is the Zombies instrument that comes with Snow Leopard supposed to work
>> with
>> iPhone applications?  It is always grayed out in Xcode.  I am guessing it
>> only works for Mac OS projects, but I'd like confirmation.
>>
>
> It works with the simulator, but not the device. Since the device doesn't
> have any swap space, and only so much memory, and since zombies make it so
> that memory will not be deallocated, your app would have a super short
> lifespan if you could run it with zombies turned on in the device.
>

I've run my app with zombies on the device for a few minutes, which is
usually enough to identify problems.

I have been playing around with Instruments trying to get it to run my app
in the simulator with zombies enabled and I can't quite figure out the
sequence of steps required to make it happen.  Do you happen to have a
recipe?

Xcode won't let me select Zombies as an instrument, even when the target is
set to Simulator.

-jsd-
___

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: Default Core Data errors

2009-10-14 Thread Rick Mann
Do you meant the console in Xcode? There's nothing there (and I  
checked Console.app just to be sure, same stuff there).


No exceptions (I checked "Stop on Objective-C Exceptions" and created  
a symbolic breakpoint on "objc_exception_throw" just to be sure).


On Oct 14, 2009, at 03:10:49, Volker in Lists wrote:


Hi Rick,

any messages in the console? Usually you should get more information  
there. Also, what happens when run from Xcode in debug settings?  
Maybe activate an objc_exception_throw breakpoint in advance.


Cheers,
Volker

Am 14.10.2009 um 10:07 schrieb Rick Mann:

I'm having some issues with my Core Data app. It's based on the  
Xcode 3.2  Core Data document stationery. I thought it was working  
okay earlier, but now the simplest operation doesn't work. I launch  
my app, create a new document, save it, and then try to re-open it.  
The app displays an alert that says "The document “Untitled.telem”  
could not be opened."






___

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


SelectedRowIndexes

2009-10-14 Thread gMail.com
Hi,
when I call [tableView selectedRowIndexes];
I always get a indexSet already sorted by row.
Instead I need to sort it as the selection order.
I mean, if the user selected the rows in the order

Row 6
Row 2 
Row 8

I want to get 6, 2, 8 and not 2, 6, 8 as I get now with selectedRowIndexes.
How can I do that?

Please note that I can select the rows even programmatically, because the
user selects an object on the canvas.

Thanks
-- 
LL


___

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: Code Sign verification on Leopard

2009-10-14 Thread Clark Cox
On Wed, Oct 14, 2009 at 12:37 AM, Charles Srstka
 wrote:
> On Oct 13, 2009, at 10:41 AM, Jens Alfke wrote:
>
>> This code sample seems to be designed to verify the binary that it's
>> compiled into. That's sort of useless for security purposes, like yelling
>> downstairs "are you a burglar?" If your own code's already been modified,
>> it's easy enough for the hacker to disable the code that does the checking
>
> Well yeah, if the hacker is specifically targeting your app. However, if the
> app gets infected by a virus or something, it won't be doing that, and your
> code signing check will catch it. So it's not completely useless for
> security purposes.

You say that as if "getting infected by" and "being specifically
targeted by" a virus are different things. Either a virus has targeted
your application, and as such knows enough about it to modify it's
code (and therefore replace/defeat any signature check), or it's
targeting something outside of your application (a framework, a bundle
loaded into your application, etc.), in which case the changed code
happens outside of your application's code and a signature check will
not find any issues.

If you're trying to detect malicious changes to your application, then
checking your own signature is useless, the entity doing the check has
to be beyond the reach of the malicious code in order to be trusted;
once that check is inside the application code itself, it becomes
useless.

-- 
Clark S. Cox III
clarkc...@gmail.com
___

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

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

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

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


Re: Examples of MVC pattern with Core Data

2009-10-14 Thread I. Savant

On Oct 14, 2009, at 11:29 AM, Kyle Sluder wrote:

On Oct 14, 2009, at 7:03 AM, Darren Wheatley > wrote:


I've been Googling and searching the XCode docs for good examples  
of using the MVC pattern with Core Data, but not had a lot of  
success.


Because MVC is so pervasive throughout Cocoa, its use is rarely  
called out except in introductory documentation. Almost every Core  
Data application sample you find is going to employ an MVC  
architecture, if for no other reason than that's what AppKit is  
designed for.


  Indeed the most basic example (creating a new, plain Core Data  
application - non-document-based) is almost a perfect, complete  
example. Just add a "Person" entity with the usual attributes, then  
(is it option-drag, command-drag, control-drag?) drag the entity into  
the main window of your nib and let it create the basic interface  
needed for managing "Person" objects.


  Make sure it works as expected and there you have a complete  
example. The model (your Managed Object Model), the view (your window,  
table, fetch button, search bar, etc.), and the controller (the  
NSArrayController added when the UI was auto-generated) are all  
represented in a rather clean demonstration.


  Of course there are other things about this basic setup that  
represent all three of these layers, but asking "what are they" is far  
too broad a question. You'll just have to study the Cocoa frameworks  
to identify them.


  As other recent threads highlight, there's room for flexibility in  
both interpretation of the MVC "rules" and the implementation of your  
application's ultimate design.


--
I.S.


___

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: Examples of MVC pattern with Core Data

2009-10-14 Thread Kyle Sluder
On Oct 14, 2009, at 7:03 AM, Darren Wheatley > wrote:


I've been Googling and searching the XCode docs for good examples of  
using the MVC pattern with Core Data, but not had a lot of success.


Because MVC is so pervasive throughout Cocoa, its use is rarely called  
out except in introductory documentation. Almost every Core Data  
application sample you find is going to employ an MVC architecture, if  
for no other reason than that's what AppKit is designed for.


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


QLPreviewPanel causes warnings in QLThumbnailImageCreate?

2009-10-14 Thread Keith Blount
Hello,

I'm using Matt Gemmell's NSImage category to create an NSImage from a QuickLook 
thumbnail, which uses QLThumbnailImageCreate() to generate the thumbnail image.

My app also makes use of the new 10.6 QuickLook functionality to bring up a 
QuickLook panel for certain file previews.

However, there seems to be a strange (though apparently minor) conflict here. 
QLThumbnailImageCreate() works absolutely fine _until_ a QuickLook panel is 
created. After that, even if the QuickLook panel is ordered out, calling 
QLThumbnailImageCreate() (on the main thread) generates the following error 
message on the console:

[QL] Asking to compute a thumbnail in main thread is potentially blocking the 
user interface

I've created a small demo app, showing the problem, here:

http://www.literatureandlatte.com/misc/QLWarningTest.zip

But you could equally see the problem by placing the following code somewhere, 
such as as in -awakeFromNib:

NSURL *fileURL = [NSURL fileURLWithPath:[[NSBundle mainBundle] 
pathForResource:@"SomeFile" ofType:@"type"]];
NSDictionary *dict = [NSDictionary dictionaryWithObject:[NSNumber 
numberWithBool:YES] forKey:(NSString *)kQLThumbnailOptionIconModeKey];

// Call thumbnail image create once - there will be no warning.
NSLog (@"1");
CGImageRef ref = QLThumbnailImageCreate(kCFAllocatorDefault, (CFURLRef)fileURL, 
CGSizeMake(48, 48), (CFDictionaryRef)dict);

// Call it again - and again no warning.
NSLog (@"2");
ref = QLThumbnailImageCreate(kCFAllocatorDefault, (CFURLRef)fileURL, 
CGSizeMake(48, 48), (CFDictionaryRef)dict);

// Order the QL panel front.
[[QLPreviewPanel sharedPreviewPanel] makeKeyAndOrderFront:nil];

// Now when we try to create a thumbnail, there will be a warning.
NSLog (@"3");
ref = QLThumbnailImageCreate(kCFAllocatorDefault, (CFURLRef)fileURL, 
CGSizeMake(48, 48), (CFDictionaryRef)dict);

The console output will be:
1
2
3
[QL] Asking to compute a thumbnail in main thread is potentially blocking the 
user interface

So, my question is, does anyone know why this warning gets generated by 
QLThumbnailImageCreate after a QuickLook panel has been created in an 
application? The docs say that QLThumbnailImageCreate should "generally" be 
called from a background thread, but do not say that it must be. Is this 
function not supposed to be placed in the main thread after all? I'm not sure 
how I would really improve on Matt Gemmell's NSImage category (included in the 
demo app above, and which I seem to remember reading on his site has already 
had someone at Apple tweak it), as I'm not really sure why the thumbnail 
creation for an image about to be placed in the main interface should have to 
go in a different thread.

Many thanks in advance and all the best,
Keith


  
___

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


UIControl = what was the event again?

2009-10-14 Thread Roland King

I must be missing something obvious here but  ...

UIControl has a method

- (void)addTarget:(id)target action:(SEL)action forControlEvents: 
(UIControlEvents)controlEvents


which lets you add an action to be called when any of the given  
controlEvents occur. ControlEvents are a bitmask of events which tell  
you if a touch went down, or up inside, or was dragged etc., there's  
about 16 of them, you or them together and get called when any of them  
occur.


The selector can have one of the following signatures

- (void)action
- (void)action:(id)sender
- (void)action:(id)sender forEvent:(UIEvent *)

none of those tell you what the control event bitmask was. The UIEvent  
is something slightly different, it's related to the actual touch  
event and doesn't (I think) contain the UIControlEvent. The sender  
(UIControl) doesn't have a way to find the control events either.


I'd like to have one method which deals with a number of control  
events as I have some common code regardless of which event or events  
happened but I still need to know what the UIControlEvents were for  
some specific processing.


Am I missing a way to find out what UIControlEvents were used when the  
action was called or do I really have to separate my code into


-(void)actionWithUIControlEventX;
-(void)actionWithUIControlEventY;

etc

potentially just calling one private method with an extra argument.

Roland
___

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: Property List Format vs NSKeyedArchiver Format

2009-10-14 Thread Michael Ash
On Tue, Oct 13, 2009 at 6:24 PM, Ken Ferry  wrote:
> On Tue, Oct 13, 2009 at 2:40 PM, Jens Alfke  wrote:
>
>>
>> On Oct 13, 2009, at 1:08 PM, Bridger Maxwell wrote:
>>
>>  I would like to read more on the NSKeyedArchiver XML format, but can't
>>> find
>>> documentation on it. Is it open?
>>>
>>
>> No. It's undocumented and could change in the future; writing code for
>> another platform that parses it would probably be a bad idea.
>
>
> I agree.
>
> But as you originally noted, there's nothing stopping you from writing your
> own coder subclasses that read and write a format you understand.
>
> Nor is there anything stopping you from dropping in classes written by
> someone else.  You could use
> MAKeyedArchiver.
>  As long as the source is in your app, you control the format.

Note that MAKeyedArchiver is old and crusty. In particular, it was
written at a naive time in my life when it seemed like Macs would be
big-endian forever. The archives it creates are not cross-compatible
between PPC and x86. I think that it *might* work in 64-bit mode,
simply because I was lucky enough to use int everywhere and their size
didn't change, but I wouldn't count on it.

In short: MAKeyedArchiver is probably instructive, and may even be a
good base to start with when creating your own, but please don't use
it as-is.

(If anyone feels like fixing it up to use proper stdint types and byte
swapping functions, I'll be happy to add your contributions to the
package.)

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


iPhone/iPod Device Detection Necessary for App Approval?

2009-10-14 Thread Anthony Smith
I read on a forum somewhere that it's necessary to detect the device  
your app is running on and enable/disable features accordingly (e.g.  
disable phone feature on iPod) for app approval. If an app is meant  
for the iPhone only, is it necessary to detect the device and notify  
the user?

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

Examples of MVC pattern with Core Data

2009-10-14 Thread Darren Wheatley

Hi,

I've been Googling and searching the XCode docs for good examples of  
using the MVC pattern with Core Data, but not had a lot of success.


Can anyone suggest some good examples?

I'm learning Cocoa at the moment, and while I'm happy with the MVC  
pattern (and design patterns in general), I'd like to validate my  
understanding by seeing some real code example of an MVC app that uses  
Core Data.


Thanks

Darren.

___

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


Question about Apple's updated Sketch-112 program

2009-10-14 Thread Michael de Haan

Hi All,
I think this is an easy issue...for those with more knowledge than  
I  :)  but it has had me stumped for a while now.


I am puzzled about one of  the calls (the "invalidateGraphic method")  
of the  setter of the NSArray (_graphics) in the document.m file. The  
sequence occurs when data is read from an (archived) saved file. The  
sequence, I believe, goes like this.



- (BOOL)readFromData:(NSData *)data ofType:(NSString *)typeName error: 
(NSError **)outError {

set up stuff...
 [self setGraphics:graphics];



Which calls:



- (void)setGraphics:(NSArray *)graphics {
unsigned i = [_graphics count];
while (i-- > 0) {
[self removeGraphicAtIndex:i];
}
i = [graphics count];
while (i-- > 0) {
[self insertGraphic:[graphics objectAtIndex:i] atIndex:0];
}
}


which calls


- (void)insertGraphic:(SKTGraphic *)graphic atIndex:(unsigned)index {
[[[self undoManager] prepareWithInvocationTarget:self]  
removeGraphicAtIndex:index];

[_graphics insertObject:graphic atIndex:index];
[graphic setDocument:self];
[self invalidateGraphic:graphic];

and the part that I do not get:

- (void)invalidateGraphic:(SKTGraphic *)graphic {
NSArray *windowControllers = [self windowControllers];
[windowControllers makeObjectsPerformSelector:@selector 
(invalidateGraphic:) withObject:graphic];}
I **think** I see what each line is doing, but, fail to grasp the  
overall essence of the call.

Thanks in advance.
___

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: Validate NSToolbarPrintItem

2009-10-14 Thread Knut Lorenzen


Am 13.10.2009 um 21:00 schrieb Knut Lorenzen:


how does one validate a NSToolbarPrintItem that was added in IB 3.2?



To answer my own question (and for the archives):

This looks like a bug in IB's predefined Print Toolbar Item.  
Workaround: Simply delete it, add a custom item instead, set its image  
name to "NSToolbarPrint" and make sure that "Autovalidates" is  
checked. Now set the Target to "First Responder" (or whatever you wish  
to print) and the action to "print:" and all is well. It is not  
necessary to implement (BOOL)validateToolbarItem:(NSToolbarItem *) 
theItem for all this to work.


Cheers,

Knut

___

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


iPhone developer training

2009-10-14 Thread Martin Crane

Hi,

Based on personal experience, can anyone recommend the best training  
course (in the UK only, please) for iPhone development?


Thanks in advance!

Regards,

Martin Crane
Senior Software Engineer
Vicomsoft

Vicomsoft Ltd.
21 Oxford Road,
Bournemouth.
BH8 8ET
UK

Tel: 08707 273510 (UK)
+44 (0)1202 204830 (International)
Fax: 08707 273550 (UK)
+44 (0)1202 297900 (International)

www.vicomsoft.com
Vicomsoft Limited registered in the UK No. 04352786
The Keyfort Group comprises Clickair Ltd., Keyfort Ltd., Vicomsoft  
Inc. & Vicomsoft Ltd..





___

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 NSComboBox

2009-10-14 Thread Symadept
Hi, I am designing a custom NSComboBox to display the rect image as some
ComboboxBg.png and set foreground (text) color to Red. To render image I am
doing the following things. @interface CustomComboBoxCell : NSComboBoxCell {
} @end @implementation CustomComboBoxCell -
(void)drawWithFrame:(NSRect)bounds inView:(NSView *)controlView {
NSLog(@"CPProfileComboBoxCell drawWithFrame[%f %f - %f %f]",
bounds.origin.x, bounds.origin.y, bounds.size.width, bounds.size.height);
NSRect imageRect = bounds;//[self drawingRectForBounds:bounds];//[self
imageRectForBounds:bounds]; NSLog(@"Image rect [%f %f - %f %f]",
imageRect.origin.x, imageRect.origin.y, imageRect.size.width,
imageRect.size.height); NSImage *bgImage = [NSImage imageNamed:@"ComboBox2"];
[bgImage drawInRect:imageRect fromRect:NSZeroRect
operation:NSCompositeSourceOver fraction:1.0]; NSLog(@"Image drawn"); //
Make attributes for our strings NSMutableParagraphStyle * aParagraphStyle =
[[[NSMutableParagraphStyle alloc] init] autorelease]; [aParagraphStyle
setLineBreakMode:NSLineBreakByTruncatingTail]; //[aParagraphStyle
setAlignment:NSCenterTextAlignment]; // Title attributes: system font, 14pt,
black, truncate tail NSMutableDictionary * aTitleAttributes =
[[[NSMutableDictionary alloc] initWithObjectsAndKeys: [NSColor
blackColor],NSForegroundColorAttributeName, [NSFont
systemFontOfSize:21.0],NSFontAttributeName, aParagraphStyle,
NSParagraphStyleAttributeName, nil] autorelease]; // Make a Title string
NSString * aTitle = [self stringValue];//[NSString stringWithString:@"Title"];
// get the size of the string for layout // Icon box: center the icon
vertically inside of the inset rect NSLog(@"CellFrame:[%f %f] [%f %f]",
bounds.origin.x, bounds.origin.y, bounds.size.width, bounds.size.height);
NSRect aTitleBox = bounds; [aTitleAttributes setValue:[NSColor yellowColor]
forKey:NSForegroundColorAttributeName]; [aTitle drawInRect:aTitleBox
withAttributes:aTitleAttributes]; } @end And If I dont draw the string by
myself, the chosed item will not be shown. To make the combobox to show the
value, I have to click inside once. Can anybody help me to resolve this
issue? Thanks in advance Regards symad...@gmail.com
___

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

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

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

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


Background image of CustomTableView Cells

2009-10-14 Thread Symadept
Hi,
Can you help me to fix this problem.

I am customizing my table view to show various images in the background of
the cells accordingly as

Selected : Font Changed to While Colour, Background image, Highlighted.png
Deselected/Normal: Font -> Black colour, Bg Image: Default.png

I tried to override
 - (void)drawInteriorWithFrame:(NSRect)theCellFrame
inView:(NSView*)theControlView

 of NSCell to change the Font Color and BgImage according to the state as I
mentioned earlier.

Result: Once the application launched it is ok. Once I select col1 and
select col2, my Col1 still shows the Highlighted image, infact it is
deselected and supposed to show the Default Image. This because my Default
image is a transparent image. Even after overlapping Default.png on
Highlighted.png it is showing the same Highlighted.png.

I guess what I need to do is to remove the image from the Cell before
redrawing it. How to do I really don't know.

Kindly look into this and help me in this regards.

 CustomTableCell

@interface CustomTableCell : NSCell {


}


@end


#import "CustomTableCell.h"



@implementation CustomTableCell

- (void)drawInteriorWithFrame:(NSRect)theCellFrame
inView:(NSView*)theControlView

{

NSLog(@"CustomTableCell drawInteriorWithFrame");

NSImage *bgImage = [NSImage imageNamed:@"DefaultCell"];

 // Make attributes for our strings

NSMutableParagraphStyle * aParagraphStyle = [[[NSMutableParagraphStyle alloc]
init] autorelease];

[aParagraphStyle setLineBreakMode:NSLineBreakByTruncatingTail];

[aParagraphStyle setAlignment:NSCenterTextAlignment];

   // Title attributes: system font, 14pt, black, truncate tail

NSMutableDictionary * aTitleAttributes = [[[NSMutableDictionary alloc]
initWithObjectsAndKeys:

   [NSColor blackColor],NSForegroundColorAttributeName,

   [NSFont systemFontOfSize:21.0],NSFontAttributeName,

   aParagraphStyle, NSParagraphStyleAttributeName,

   nil] autorelease];

 // Make a Title string

NSString * aTitle = [self stringValue];

NSLog(@"CellFrame:[%f %f] [%f %f]", theCellFrame.origin.x, theCellFrame.
origin.y, theCellFrame.size.width, theCellFrame.size.height);

NSRect anIconBox = theCellFrame;

NSRect aTitleBox = NSMakeRect(theCellFrame.origin.x,

  theCellFrame.origin.y + theCellFrame.size.height/2-10,

  theCellFrame.size.width,

  theCellFrame.size.height);


 if( [self isHighlighted])

{

// if the cell is highlighted, draw the text white

[aTitleAttributes setValue:[NSColor whiteColor] forKey:
NSForegroundColorAttributeName];

bgImage = [NSImage imageNamed:@"FocusedCell"];

}

else

{

// if the cell is not highlighted, draw the title black and the subtile gray

[aTitleAttributes setValue:[NSColor orangeColor] forKey:
NSForegroundColorAttributeName];

}

 // Draw the icon

[bgImage drawInRect:anIconBox fromRect:NSZeroRect operation:
NSCompositePlusLighter fraction:1.0];

 // Draw the text

[aTitle drawInRect:aTitleBox withAttributes:aTitleAttributes];

}

@end


 CustomTableView

@interface CustomTableView : NSTableView {


}


@end


#import "CustomTableView.h"



@implementation CustomTableView


- (void)awakeFromNib

{

NSLog(@"CustomTableView awakeFromNib");

[[self enclosingScrollView] setDrawsBackground:NO];

}


- (void)drawBackgroundInClipRect:(NSRect)clipRect

{

NSLog(@"CustomTableView drawBackgroundInClipRect");

}


#pragma mark -

#pragma mark Selection Highlighting


- (id)_highlightColorForCell:(NSCell *)cell

{

// we need to override this to return nil

// or we'll see the default selection rectangle when the app is running

// in any OS before leopard

 // you can also return a color if you simply want to change the table's
default selection color

return nil;

}


@end


Thanks in advance

Regards
symadept
___

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: NSString Class Instance Variables

2009-10-14 Thread Andy Lee

On Oct 14, 2009, at 3:39 AM, Ariel Feinerman wrote:

It seems interesting. If I want to create my own superclass for class
cluster, how can I implement it? Could you show simple example,
please?


Maybe Google knows?  


The first hit is 

--Andy

___

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: Default Core Data errors

2009-10-14 Thread Volker in Lists
Hi Rick,

any messages in the console? Usually you should get more information there. 
Also, what happens when run from Xcode in debug settings? Maybe activate an 
objc_exception_throw breakpoint in advance.

Cheers,
Volker

Am 14.10.2009 um 10:07 schrieb Rick Mann:

> I'm having some issues with my Core Data app. It's based on the Xcode 3.2  
> Core Data document stationery. I thought it was working okay earlier, but now 
> the simplest operation doesn't work. I launch my app, create a new document, 
> save it, and then try to re-open it. The app displays an alert that says "The 
> document “Untitled.telem” could not be opened."
> 

___

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: Getting AAC tag information

2009-10-14 Thread Sven

On Tue, 13 Oct 2009, Jens Alfke wrote:



On Oct 13, 2009, at 9:30 AM, Sven wrote:

Thanks... I don't want to encode any audio files, I merely want to be able 
to get and set tag data. For MP3s I can use id3lib no problems, but that 
doesn't help me with AAC files. I guess if there's no way to edit tags via 
the Apple libraries (if I understand you correctly) then the only thing 
left to do is write my own.


You can get tags via QuickTime. The problem is that changing tags, in 
general, requires re-writing the entire file. I think QuickTime could be used 
to update those tags along the way, if it were reading the file contents and 
writing them out to a new file, but I don't know nearly enough about the very 
gnarly QuickTime APIs for that.


There is an open source project called AtomicParsely that is supposed to help 
with parsing and generating AAC metadata, but I haven't used it.


?Jens


I saw AtomicParsely and they do a good job of describing the weird and 
wonderful structure of atoms in m4a's I'll have a closer look at their 
library and see what can be done. Otherwise I'll have to stick with just 
ID3 support for now until I can get my head around tagging AACs


thanks again

./Sven
___

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


Default Core Data errors

2009-10-14 Thread Rick Mann
I'm having some issues with my Core Data app. It's based on the Xcode  
3.2  Core Data document stationery. I thought it was working okay  
earlier, but now the simplest operation doesn't work. I launch my app,  
create a new document, save it, and then try to re-open it. The app  
displays an alert that says "The document “Untitled.telem” could not  
be opened."


Is there a way to find out what it doesn't like?

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

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


Re: Handle multiple screens & mouse

2009-10-14 Thread Gabriel Höhener

Thank you for your response!

The problem is not about the window but about the mouse. When i  
programmatically move the mouse around and cross the borders of my  
screens, it jumps to (0,0) on the mainscreen..
The mouse must know the screen borders, which is not that difficult.  
But when I move the order of the screens, the origin changes... And  
HOW do I calculate dynamically that edges... if I can do that, my  
problem is solved :S


Thank you!!!

José Gabriel Höhener

Am 14.10.2009 um 05:46 schrieb Jens Alfke :



On Oct 13, 2009, at 2:35 PM, Gabriel Höhener wrote:

How do I handle multiple screens, if I want to drag a window  
programmatically from one screen [NSScreen mainscreen] to another  
[[NSScreen screens] objectAtIndex:x]?
I know that I can access the frame from each screen and get like  
that the origin and the sizes of each one. But somehow it doesn't  
work properly.


If you know the ending position of the window, call [window  
setFrame: newFrame display: YES animate: YES].
Next time tell us exactly what you already tried and what exactly  
goes wrong.


—Jens

___

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

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

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

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


Re: NSString Class Instance Variables

2009-10-14 Thread Ariel Feinerman
It seems interesting. If I want to create my own superclass for class
cluster, how can I implement it? Could you show simple example,
please?

--
best regards
Ariel
___

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: Code Sign verification on Leopard

2009-10-14 Thread Charles Srstka

On Oct 13, 2009, at 10:41 AM, Jens Alfke wrote:

This code sample seems to be designed to verify the binary that it's  
compiled into. That's sort of useless for security purposes, like  
yelling downstairs "are you a burglar?" If your own code's already  
been modified, it's easy enough for the hacker to disable the code  
that does the checking


Well yeah, if the hacker is specifically targeting your app. However,  
if the app gets infected by a virus or something, it won't be doing  
that, and your code signing check will catch it. So it's not  
completely useless for security purposes.


Charles
___

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

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

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

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


Re: How to iterate over all objects stored with NSCoder

2009-10-14 Thread Graham Cox


On 14/10/2009, at 10:24 AM, Graham Cox wrote:

It can also be parsed by the Property List Editor utility, which at  
least gives you a glimpse at the names of the classes and keys used.  
It takes some detective work but you can even work out what keys are  
with which class. It's not much, but it's something.



One quick way to get a rough look at an archive is to load it into a  
dictionary using -dictionaryWithContentsOfURL: In that dictionary are  
four keyed items. One of them is a large array keyed by '$objects'. If  
you just log that array it gives you most of what you need to know.


Where an object references another it does so using a private object  
class CFKeyedArchiverUID, which appears to simply hold the index of  
the $objects array item it refers to. This object does write out a  
sensible description to the log despite being private, so the index it  
points to is easily read as its "value". (Note that these references  
are removed from the display when examining an archive with the  
Property List Editor utility, but they are crucial for decoding an  
archive). Each dearchivable object is represented by a dictionary  
whose key/value pairs are simply the keys and values that were written  
by the -encodeWithCoder: method. There is also the key $class which  
points, via a CFKeyedArchiverUID, to another dictionary which contains  
$classes -> an array giving the class inheritance structure of the  
object as a simple list of strings and $classname -> the classname  
again (same as element 0 in the $classes array).


So while the format isn't public, it's pretty easy to reverse engineer  
as there's no real trickery going on, just a fairly extensive effort  
to avoid writing the same info more than once.


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