RE: UIEvent timestamp clarification

2011-01-16 Thread Andrew Coad

Apologies, I didn't see Matt's reply despite searching several times. Problem 
solved, thanks.

Andrew Coad



> Date: Sun, 16 Jan 2011 19:36:39 -0800
> Subject: Re: UIEvent timestamp clarification
> From: kyle.slu...@gmail.com
> To: andrewc...@hotmail.com
> CC: cocoa-dev@lists.apple.com
> 
> On Sun, Jan 16, 2011 at 7:30 PM, Andrew Coad  wrote:
> >
> > Does anyone have a view on this?
> 
> Did you read Matt's reply?
> 
> --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: “EXC_BAD_ACCESS” object is not nil but not accessible

2011-01-16 Thread Marco Frisan

Il giorno 17/gen/2011, alle ore 04.04, Kyle Sluder ha scritto:

> On Sun, Jan 16, 2011 at 4:48 PM, Marco Frisan  wrote:
>> Yes I know that. The problem is that I am was not able to find which 
>> pointer. And the reason I am not able to find it is that the line that cause 
>> the application block is:
>> 
>> NSDictionary * attributes = _record.attributes;
>> 
>> inside the numberOfRowsInTableView: method of my custom class 
>> VLVolumeDetailsViewController.
>> 
>> I checked with debugger and _record, that points to a VLDiskItemRecord 
>> object, is not nil.
>> attributes should be not nil too and are retained by the object pointed by 
>> _record when they are initialized.
> 
> Just because they're not nil doesn't mean they point to valid objects.
> The objects might have been freed.
> 
> First, make sure you're using Build & Analyze. This will catch many
> common memory management errors. If that doesn't find the problem, run
> with the Zombies instrument, which will track object allocations and
> frees and pinpoint where your object is going away.
> 
> It is better to do this rather than assume you have "fixed" the
> problem by using -initWithDictionary:copyItems:.
> 
> --Kyle Sluder

Build and Analize builds succefully (no error, no warning, no analize errors). 
I launched Instruments with NSZombieEnabled, and I in this case I got a first 
track...

Finally I discovered this zombie. It was not the NSDictionary of attributes, 
neither my custom object VLDiskItemRecord. And the line pointed by the debugger 
as the cause of the error was not responsible of anything (apparently).
The zombie was a CFArray.

The place where zombie were addressed was was few lines later, where I get the 
two arrays sending allKeys and allValues messages to the _attributes dictionary 
and later, when I send the message objectAtIndex: to one of them, in the method 
tableView:objectValueForTableColumn:row:.

Actually the object pointed by _attributesKeys and _attributesValues were not 
retained.

Though I am surprised that an error in a method cause the debugger to place the 
error in a totally different method.

Thanks you all for help


___

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: “EXC_BAD_ACCESS” object is not nil but not accessible

2011-01-16 Thread Ken Thomases
On Jan 16, 2011, at 10:37 PM, Marco Frisan wrote:

> I verified with Instruments - Leaks the version available on the provided 
> link (since I modified my local copy) and the result is that I have no memory 
> leak.

A leak is when something is under-released.  The most likely culprit in your 
case is something that is over-relaesed.  In other words, you have used the 
wrong tool to investigate.  You should have used the Zombies instrument as was 
previously suggested.

> And, surprise! _attributes points to a NSEvent instance!!!

Again, this is precisely a symptom of over-releasing (or, equivalently, failure 
to retain) an object.  That object has been deallocated and some other object 
now occupies that memory location.


> Using the debugger I discovered that attributesOfItemAtPath:error: does not 
> return a simple NSDictionary, but an instance of NSFileAttributes, a private 
> class that is probably a subclass of NSDictionary. I am inclined to think 
> that the cause of this unpredictable behavior could be the way 
> NSFileAttributes is implemented.

To this I say: 
http://boredzo.org/blog/archives/2010-11-13/four-rules-of-debugging

Regards,
Ken

___

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

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

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

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


Re: “EXC_BAD_ACCESS” object is not nil but not accessible

2011-01-16 Thread Marco Frisan

Il giorno 17/gen/2011, alle ore 03.02, William Squires ha scritto:

> I'd have a look at your object allocations/deallocations with Instruments - 
> this sort of cr*p usually means you over-released something, or you forgot to 
> retain it. Remember that containers have no way of knowing if you 
> over-release an object stored in them from somewhere else. i.e.
> 
> NSString *myBoobooString = [NSString stringWithFormat:@"%@ - %@", @"foo", 
> @"bar"];
> NSString *myGoodString = @"bas"
> NSArray *myOopsieArray = [NSArray arrayWithObjects:myBoobooString, 
> myGoodString, nil];
> [myBoobooString release];
> [myGoodString release];
> ... <- something else happens here
> [myBoobooString release]; <- Instant kablooey when you release the NSArray, 
> or try to enumerate and traverse it!

I verified with Instruments - Leaks the version available on the provided link 
(since I modified my local copy) and the result is that I have no memory leak.

The surprise is that the first execution, using Instruments and Breakpoint 
button activated (even if there is no breakpoint placed in code), did not block.

The second did not block too. But it displayed 28 leaks, that could be the 
number of attributes * 2 (keys and values).

I controlled and controlled again the code 10...50 times and I have not been 
able to find if I actually release something I should not.

Though, the point is that the program, if launched without Instruments, crashes 
exactly when I click over a volume to display the detailed attributes in the 
right table. If I activate Breakpoints button (and so, debugger) Xcode blocks 
at line 20 of  VLDiskItemRecord.m, where there is this code:

@synthesize attributes = _attributes;

If I select the previous call (from the right pop up menu, over the editor 
view, while debugger is still active) Xcode points to line 57 of 
VLVolumeDetailsViewController.m, inside the implementation of method 
numberOfRowsInTableView:. So, the code that actually causes the error (as I 
already explained) is:

NSDictionary * attributes = _record.attributes;

We can exclude that the cause could be "NSDictionary * attributes = " ;-)

So the problem is "_record" or ".attributes". Based on the Xcode behavior, I am 
inclined to think it is ".attributes".

Then, what I did is to place a breakpoint the line before where I test for 
_record nullity. Launched the program. Press continue once, since the first 
time the method is called there is no volume selected. And then, I selected a 
volume. Application stopped at that line and I passed the mouse over _record to 
see its state (yellow pop-up views, with expansions arrows, the same info you 
can get from debugger window).
And, surprise! _attributes points to a NSEvent instance!!!

Though _attributes was obtained calling attributesOfItemAtPath:error:, no error 
was produced, and I retained it... to be honest I did not, though I corrected 
it and retained _attributes but result does not change. I get the 
EXC_BAD_ACCESS error even if i do [[_attributes retain] retain].
And now, after retaining _attributes, if I verify the state of _record at the 
nullity test line, _attributes points correctly to a NSDictionary.

So, my conclusions are: ?

There is no possible control over dictionaries returned by convenience methods? 
I have to make copies of them every time I need one?

For now I resolved with initWithDictionary:copyItems:.

Thanks

P.S. I just made some changes to initAttributes method in VLDiskItemRecord.m:

- (void)initAttributes {
NSLog(@"%s", __FUNCTION__);

NSError * error = nil;
NSFileManager * fm = [NSFileManager defaultManager];
NSDictionary * attr = [fm attributesOfItemAtPath:_mountPoint 
error:&error];

if (error != nil || attr == nil) {
NSLog(@"Impossible to get attributes for path \"%@\". Reason: 
%@",
  _mountPoint,
  [error localizedDescription]);

_attributes = nil;

return;
}

_attributes = [attr retain];
}

Using the debugger I discovered that attributesOfItemAtPath:error: does not 
return a simple NSDictionary, but an instance of NSFileAttributes, a private 
class that is probably a subclass of NSDictionary. I am inclined to think that 
the cause of this unpredictable behavior could be the way NSFileAttributes is 
implemented.

___

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

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

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

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


Re: Why can't a modal view controller present another in viewDidLoad?

2011-01-16 Thread Luke Hiesterman
Delayed performance is not appropriate for something like this, because that 
fact that your view was just loaded is not a guarantee that it's about to be 
added to the view hierarchy. Delayed performance should not be used as a 
haphazard crutch because it seems to make a given problem go away. It should 
only be used when the problem and the purpose of the delayed perform are both 
well understood. 

Luke

Sent from my iPad

On Jan 16, 2011, at 6:46 PM, Matt Neuburg  wrote:

> On Sun, 16 Jan 2011 13:47:06 -0800, G S  said:
>> On Sun, Jan 16, 2011 at 11:47 AM, Luke Hiesterman  wrote:
>>> viewDidLoad is called the first time the view property of the vc is 
>>> accessed - that's when loading happens. There is no guarantee that the view 
>>> is in a window at that time, and presenting a modal vc on a vc whose view 
>>> is not in a window does not make sense. Perhaps viewDidAppear is what you 
>>> were looking for. 
> 
> Or just use delayed performance. I use delayed performance a *lot*. Like 
> whipped cream, it covers a multitude of sins. m.
> 
> --
> matt neuburg, phd = m...@tidbits.com, 
> A fool + a tool + an autorelease pool = cool!
> AppleScript: the Definitive Guide - Second Edition!
> http://www.apeth.net/matt/default.html#applescriptthings___
> 
> Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)
> 
> Please do not post admin requests or moderator comments to the list.
> Contact the moderators at cocoa-dev-admins(at)lists.apple.com
> 
> Help/Unsubscribe/Update your Subscription:
> http://lists.apple.com/mailman/options/cocoa-dev/luketheh%40apple.com
> 
> This email sent to luket...@apple.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: Why can't a modal view controller present another in viewDidLoad?

2011-01-16 Thread G S
> Or just use delayed performance. I use delayed performance a *lot*. Like 
> whipped cream, it covers a multitude of sins. m.

Hm, I'll have to remember that.  Whipped cream on my misdeeds, that is.

Meanwhile, the viewDidAppear method does work; but it gets into an
endless loop because when you dismiss the modal controller,
viewDidAppear gets called again and re-invokes it.  So I added a
"firstAppearance" boolean to prevent that.

Thanks for the response.

Gavin
___

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

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

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

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


Re: UIEvent timestamp clarification

2011-01-16 Thread Kyle Sluder
On Sun, Jan 16, 2011 at 7:30 PM, Andrew Coad  wrote:
>
> Does anyone have a view on this?

Did you read Matt's reply?

--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: UIEvent timestamp clarification

2011-01-16 Thread Andrew Coad

Does anyone have a view on this?

Andrew Coad



> From: andrewc...@hotmail.com
> To: cocoa-dev@lists.apple.com
> Date: Wed, 12 Jan 2011 18:36:56 -0500
> Subject: UIEvent timestamp clarification
> 
> 
> Reading through the docs, the approximate flow from a user touching an 
> interface component (e.g. a button) to the touch event being processed by the 
> application is:
> 
>  - User touches (e.g. a UIButton), a "touch" object is created and enqueued 
> on the dispatch thread (main thread)
>  - The touch object is dequeued, a UIEvent object is created and dispatched 
> to the target object (for handling)
> 
> The docs also state that the timestamp of the UIEvent [event timestamp] is 
> the time that the event was created.  From this I assume that [event 
> timestamp] is somewhat later than the actual time that user touched the 
> UIButton - how much later depends on system activity around that time.  Is 
> this assumption correct? If so, is there a way to get the time that the user 
> touched the interface?  The small number (indeterminate) of milliseconds lag 
> between touch time and event time is important to me.  I can tolerate 
> processing the event after an indeterminate lag but I do need to know when 
> the actual touch occurred.
> 
> ac
> 
> ___
> 
> 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/andrewcoad%40hotmail.com
> 
> This email sent to andrewc...@hotmail.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: Question about split view

2011-01-16 Thread Kyle Sluder
On Sun, Jan 16, 2011 at 6:44 PM, Matt Neuburg  wrote:
> I've had similar problems with a UINavigationController on iPhone where if 
> there's a memory warning while the root view is hidden and the app is in the 
> background the nav bar stack is messed up when we resume the app. My solution 
> is to implement didReceiveMemoryWarning and just return, thus preventing the 
> root view from being unloaded. You can call *that* a hack if you like, but my 
> attitude is, hey iOS, if you're not going manage memory correctly I'm not 
> going to let you mess with memory at all. Anyway, what I'm suggesting is that 
> you try that sort of thing, to see if you can prevent the split view and its 
> subcontrollers from having their views unloaded. m.

Please do say you've filed a bug on this. I'm sure developers would
love if the frameworks *did* manage memory correctly. :)

--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: Get iphoto scripting bridge handle without starting iphoto?

2011-01-16 Thread Kyle Sluder
On Sun, Jan 16, 2011 at 5:43 PM, Ken Ferry  wrote:
> Poor change management in what sense?  If the file is not intended for 3rd
> party use, then how is it wrong to change it?  Do you worry about changing
> your file formats?  It is really not possible for you to be aware of what
> might cause that file to have to change.  For example, if I were doing this
> myself, my first impulse would be to have no such file.  I'd have a
> framework that reads the native representation of the library rather than
> this on-the-side XML thing.  I would delete the XML thing.

Hm, sounds like iTunes. ;-)

FWIW, Apple people have claimed that the iTunes XML library exists
specifically for interaction with other apps, but there's never been
any official word that it's cool for *third-party* apps to rely on
this file and its format. So people who want to poke at the iTunes
library without relying on Apple Events are kind of operating in a
gray area.

--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: “EXC_BAD_ACCESS” object is not nil but not accessible

2011-01-16 Thread Kyle Sluder
On Sun, Jan 16, 2011 at 4:48 PM, Marco Frisan  wrote:
> Yes I know that. The problem is that I am was not able to find which pointer. 
> And the reason I am not able to find it is that the line that cause the 
> application block is:
>
> NSDictionary * attributes = _record.attributes;
>
> inside the numberOfRowsInTableView: method of my custom class 
> VLVolumeDetailsViewController.
>
> I checked with debugger and _record, that points to a VLDiskItemRecord 
> object, is not nil.
> attributes should be not nil too and are retained by the object pointed by 
> _record when they are initialized.

Just because they're not nil doesn't mean they point to valid objects.
The objects might have been freed.

First, make sure you're using Build & Analyze. This will catch many
common memory management errors. If that doesn't find the problem, run
with the Zombies instrument, which will track object allocations and
frees and pinpoint where your object is going away.

It is better to do this rather than assume you have "fixed" the
problem by using -initWithDictionary:copyItems:.

--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: Get iphoto scripting bridge handle without starting iphoto?

2011-01-16 Thread Matt Neuburg
On Fri, 14 Jan 2011 19:10:03 +0100, Gabriel Zachmann  
said:
>My question is: can I get a scripting bridge handle on iPhoto without making 
>iPhoto launch?

Scripting Bridge is about sending Apple events to an application. That 
application must be running or you can't send it Apple events. That is what 
inter-application communication *is*. See chapter 3 of my AppleScript book. m.

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

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

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

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

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


Re: NSSegmentedControl Label

2011-01-16 Thread Matt Neuburg
On Fri, 14 Jan 2011 18:57:00 -0700, koko  said:
>Ouch!
>
>Some of us need to lighten up 

Some of us need to ask questions properly. You explicitly said, "Is there a 
recommended manner to accomplish this?". I told you where to find the 
recommended use of NSSegmentedControl. Then in a later note you said "I want to 
do this whether it's recommended or not." Fine, but that's the exact opposite 
of your original question. Asking the wrong question is like kissing a frog - 
it won't get you anything and it annoys the frog. m.

>
>On Jan 14, 2011, at 5:34 PM, Conrad Shultz wrote:
>
>> As others (notably Kyle) have pointed out, there is no need to act so 
>> defensively. 
>> 
>> You specifically asked what the "recommended" way to do this is, and I 
>> simply pointed out that the approach is NOT recommended.
>> 
>> --
>> Conrad Shultz
>> www.sythetiqsolutions.com
>> 
>> On Jan 14, 2011, at 12:38, koko  wrote:
>> 
>>> It may not be recommended but I want to do it.  Should I get permission 
>>> from from steven p jobs first?
>>> 
>>> Apple HIG is not the be-all, end-all of UI design.
>>> 
>>> -koko
>>> 
>>> On Jan 14, 2011, at 1:33 PM, Conrad Shultz wrote:
>>> 
 -BEGIN PGP SIGNED MESSAGE-
 Hash: SHA1
 
 On 1/14/11 12:28 PM, koko wrote:
> Thanks Matt but the documentation is no help whatsoever. I read it.
> 
> The question remains ... What is the recommended manner to put text
> and graphic in one segment of an NSSegmentedControl.
 
 It's not recommended.
 
 - From the linked documentation:
 
 "A segment should have either an icon or a text label, but not both. See
 Controls in Apple Human Interface Guidelines."
 

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

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

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

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

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


Re: Why can't a modal view controller present another in viewDidLoad?

2011-01-16 Thread Matt Neuburg
On Sun, 16 Jan 2011 13:47:06 -0800, G S  said:
>On Sun, Jan 16, 2011 at 11:47 AM, Luke Hiesterman  wrote:
>> viewDidLoad is called the first time the view property of the vc is accessed 
>> - that's when loading happens. There is no guarantee that the view is in a 
>> window at that time, and presenting a modal vc on a vc whose view is not in 
>> a window does not make sense. Perhaps viewDidAppear is what you were looking 
>> for. 

Or just use delayed performance. I use delayed performance a *lot*. Like 
whipped cream, it covers a multitude of sins. m.

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

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

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

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

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


Re: Question about split view

2011-01-16 Thread Matt Neuburg
On Sun, 16 Jan 2011 18:35:45 -0500, Phillip Mills  said:
>I see a problem with the following scenario:
>1) Start with the template project for a split view
>2) Add a function where a modal view can be shown over it using a style of 
>UIModalPresentationFullScreen
>3) Run in portrait mode
>4) While the modal view is being shown, trigger a memory warning
>5) Dismiss the modal view
>
>The result is that the 'Events' button that brings up the popover root 
>controller is no longer displayed.  The view has been reloaded, but the 
>callback that sets up the 'Events' button hasn't been activated.
>
>I'm handling this by saving a reference to the button the first time I'm given 
>it and then,  in viewDidAppear:, checking for portrait orientation and the 
>identity of the first item on the toolbar.  This feels like a hack.  Does 
>anyone have a better strategy for this one?
>

I've had similar problems with a UINavigationController on iPhone where if 
there's a memory warning while the root view is hidden and the app is in the 
background the nav bar stack is messed up when we resume the app. My solution 
is to implement didReceiveMemoryWarning and just return, thus preventing the 
root view from being unloaded. You can call *that* a hack if you like, but my 
attitude is, hey iOS, if you're not going manage memory correctly I'm not going 
to let you mess with memory at all. Anyway, what I'm suggesting is that you try 
that sort of thing, to see if you can prevent the split view and its 
subcontrollers from having their views unloaded. m.

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

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

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

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

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


Printing Appears Very Small in Lower-Left Corner of Page

2011-01-16 Thread Gerry Beggs
I've been having a problem with my application sometimes (but not always) 
printing the full page, but it appears VERY small in the lower-left corner of 
the page.

I was having trouble reproducing it, but finally received a sample document 
from one of my users that let me reproduce it.
Still, sometimes it prints correctly filling the page, other times, it prints 
scaled down in the lower-left corner of the page.

I am using NSPrintOperation from an NSDocument to handle the printing 
operations.

When trying to debug this issue, I examined the transformation from my view's 
drawRect method using CGContextGetCTM.
I discovered something interesting:
- When the printout appears scaled down, the transformation structure is the 
same as it is when the print preview image is rendered.
- When the printout appears full-sized, the transformation structure is the 
identity matrix (ie. scale = 100%)


Since the scale of the CGContext is the same when rendering the print preview 
as it is when rendering the full-sized page, this explains why my printouts are 
appearing very small in my output.

Values 'a' and 'd' in the CGAffineTransformation structure indicate the scaling 
factor and for the print preview, it makes sense that it is scaled down for the 
print preview. But somehow, the transformation is not being set back to 100% 
scaling for the actual printing.

I've looked for unbalanced CGContextSaveGState/CGContextRestoreGState calls, 
but they are all balanced.

I've spent too much time trying to debug this. If anyone can give any ideas why 
my printouts are appearing scaled down, I would appreciate any help.
Thanks.

-- 
gbeg...@gmail.com   http://www.GerrysCuppaTea.org/

___

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: keyDown event processing -- harder than it looks?

2011-01-16 Thread Michael Crawford
Solved.

I have an NSTableView, which is intercepting keystrokes in order to support 
type-select functionality.  The solution, in my case was to add the NSTableView 
delegate method:

– tableView:shouldTypeSelectForEvent:withCurrentSearchString:

And put the keyboard handling code I need in that method.

-Michael

On Jan 11, 2011, at 6:08 PM, Corbin Dunn wrote:

> 
> On Jan 11, 2011, at 1:31 PM, Michael Crawford wrote:
> 
>> Documentation says NSWindowController inherits from NSResponder.
>> 
>> Besides, I was getting the events.  I just don't understand what this 
>> message is and why it is being tossed out every 7 keyDown messages.
>> 
>> http://developer.apple.com/library/mac/#documentation/cocoa/Reference/ApplicationKit/Classes/NSWindowController_Class/Reference/Reference.html
>> 
> 
> 
> You probably have a view in the responder chain that isn't calling super. 
> Therefore, you have to subclass higher in the responder chain (maybe the 
> view).
> 
> corbin
> 
> 
> 
>> -Michael
>> 
>> On Jan 11, 2011, at 4:25 PM, Seth Willits wrote:
>> 
>>> On Jan 11, 2011, at 11:17 AM, Michael Crawford wrote:
>>> 
 I'm trying to process a simple keyDown event by overriding -keyDown on the 
 NSWindowController derived class for my main window.
>>> 
>>> The NSWindowController doesn't receive events, only views do.
>>> 
>>> 
>>> --
>>> Seth Willits
>>> 
>>> 
>>> 
>>> ___
>>> 
>>> Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)
>>> 
>>> Please do not post admin requests or moderator comments to the list.
>>> Contact the moderators at cocoa-dev-admins(at)lists.apple.com
>>> 
>>> Help/Unsubscribe/Update your Subscription:
>>> http://lists.apple.com/mailman/options/cocoa-dev/michaelacrawford%40me.com
>>> 
>>> This email sent to michaelacrawf...@me.com
>> 
>> ___
>> 
>> Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)
>> 
>> Please do not post admin requests or moderator comments to the list.
>> Contact the moderators at cocoa-dev-admins(at)lists.apple.com
>> 
>> Help/Unsubscribe/Update your Subscription:
>> http://lists.apple.com/mailman/options/cocoa-dev/corbind%40apple.com
>> 
>> This email sent to corb...@apple.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: Get iphoto scripting bridge handle without starting iphoto?

2011-01-16 Thread Ken Ferry
On Sun, Jan 16, 2011 at 4:53 PM, Graham Cox  wrote:

>
> On 17/01/2011, at 10:20 AM, Ken Ferry wrote:
>
> > Apple is certainly able to do a dot rev of all the iLife apps
> simultaneously.
>
>
> But they cannot guarantee that a user would upgrade them all
> simultaneously, and seems unlikely they'd accept a situation where upgrading
> one would break all the other older ones still in use.
>

Yes they can… Apple can make it a single line item in Software Update.


> I know that's not any sort of guarantee, but they have a fair track record
> on that score.
>
> The design of the database makes it unnecessary even if it was
> substantially reorganised, so if it did happen that would be poor change
> management.


Poor change management in what sense?  If the file is not intended for 3rd
party use, then how is it wrong to change it?  Do you worry about changing
your file formats?  It is really not possible for you to be aware of what
might cause that file to have to change.  For example, if I were doing this
myself, my first impulse would be to have no such file.  I'd have a
framework that reads the native representation of the library rather than
this on-the-side XML thing.  I would delete the XML thing.

I also have no desire to argue about whether Apple is or is not going to
change this thing, but I don't want the last word in this thread to be
advice that people should blindly use this framework.  Think of the newbies.
:-)  Do you actually disagree with the point I'm trying to make?  I
seriously doubt it!  It's very bad to be depending on a hack and not know
it.  It's important to understand that this XML file is private data whose
very existence is not guaranteed, unless it's not, but I assume by now
someone would have told me if it was publicly supported.

-Ken
Cocoa Frameworks
___

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


Core Data Migration Error

2011-01-16 Thread Michael Link
I keep getting this error when trying to migrate a sql store:

-[Document 
configurePersistentStoreCoordinatorForURL:ofType:modelConfiguration:storeOptions:error:]
 Error NSCocoaErrorDomain 134110 {
NSUnderlyingException = "I/O error for database at 
/Users/mlink/Desktop/Untitled.db.new.  SQLite error code:1, 'no such table: 
_T_ZEVENT'";
destinationURL = "file://localhost/Users/mlink/Desktop/Untitled.db.new";
reason = "Cannot migrate store in-place";
sourceURL = "file://localhost/Users/mlink/Desktop/Untitled.db";
}

This migration is using the default mapping model created in Xcode. The Event 
entity was changed to have an abstract parent entity, before it stood alone.

I tried creating an entity migration policy subclass but none of its methods 
are called. Anyone have any ideas what the problem might be?

--
Michael___

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


Thanks!

2011-01-16 Thread William Squires
Thanks to all who responded to my query about png icons - Turns out that with a 
redesign, I don't need the UITabBar anymore...

___

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


NSPredicates vs 'NSMutableArray's of 'NSMutableDictionary's

2011-01-16 Thread William Squires
Okay, I've finally figured out how to get a UISearchBar into my iPhone app (a 
custom phone book for my company's internal use). Here's what I have

Model:
NSMutableArray (read from a .plist file in the bundle, then written out (1st 
time) to application's documents directory. Represents the list of all stores.)
  NSMutableDictionary instances (each holds the same keys, but with different 
values for the keys, all of which are either NSString or NSNumber - the keys 
are, of course, NSStrings. Each NSDictionary represents the info for a single 
store.)

why? Because these classes can read/write directly to/from plists. :)

View hierarchy:
UIWindow
  UIView
UINavigationBar
  UITableView   - This is where the StoreDetailView and 
AddEditDetailView return to when popped off
UISearchBar   the navController.
  StoreDetailView   \_ one of these will be pushed onto the navController 
when the user selects
  AddEditDetailView /  a row from the UITableView

(I may have missed one here...)

Everything worked before adding the UISearchBar. I added the UISearchBar based 
on info I read from one of those 'learn CocoaTouch for iOS' books... That shows 
up (and I've got the appropriate changes in the headers to tell my view 
controller that it implements UISearchBarDelegate), and implemented a stub 
method searchBar:textDidChange: but I don't think this is going to help. How do 
I turn this into an NSPredicate so I can search the model? Basically, I want 
something like:

this should be an NSDictionary
|
v
If (array[indexPath row] valueForKey:kCompanyCode = ) or 
(array[indexPath row] valueForKey = kStoreNum) Or (...) then
  // Use the NSPredicate to narrow the selection of rows the model will 'show' 
the view controller
else
  // do nothing - no matching fields for search text
end if

  Am I going to have to use CoreData to get NSPredicates to work here, or can I 
coerce an NSMutableArray to work if I implement some interface for searching 
with NSPredicates?
  At this point, I'm totally confused about how NSPredicates do their work.

___

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: Get iphoto scripting bridge handle without starting iphoto?

2011-01-16 Thread Graham Cox

On 17/01/2011, at 10:20 AM, Ken Ferry wrote:

> Apple is certainly able to do a dot rev of all the iLife apps simultaneously. 


But they cannot guarantee that a user would upgrade them all simultaneously, 
and seems unlikely they'd accept a situation where upgrading one would break 
all the other older ones still in use.

I know that's not any sort of guarantee, but they have a fair track record on 
that score.

The design of the database makes it unnecessary even if it was substantially 
reorganised, so if it did happen that would be poor change management.

--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: “EXC_BAD_ACCESS” object is not nil but not accessible

2011-01-16 Thread Marco Frisan
Il giorno 16/gen/2011, alle ore 19.06, Kyle Sluder ha scritto:

> On Jan 15, 2011, at 3:55 AM, Marco Frisan  wrote:
> 
>> I don't understand why _record.attributes causes a “EXC_BAD_ACCESS” signal.
> 
> This is the defining characteristic of a memory management bug: you have a 
> pointer to an object that has since been freed. Trying to use that pointer is 
> an error.
> 
> --Kyle Sluder


Yes I know that. The problem is that I am was not able to find which pointer. 
And the reason I am not able to find it is that the line that cause the 
application block is:

NSDictionary * attributes = _record.attributes;

inside the numberOfRowsInTableView: method of my custom class 
VLVolumeDetailsViewController.

I checked with debugger and _record, that points to a VLDiskItemRecord object, 
is not nil.
attributes should be not nil too and are retained by the object pointed by 
_record when they are initialized.

Though it seems that I resolved it using initWithDictionary:copyItems: and 
passing YES as its second parameter, to create a copy of the attributes 
dictionary, instead of simply retain the one returned by 
attributesOfItemAtPath:error:. Though I do not understand yet which was the 
object freed in the previous approach.

--Marco Frisan
___

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: Parental Controls altering binary

2011-01-16 Thread Dave Keck
>From TN2206 
>(http://developer.apple.com/library/mac/#technotes/tn2007/tn2206.html):

The Parental Controls, MCX, and Application Firewall subsystems in
Leopard, when encountering an unsigned program, will ad hoc sign the
program in order to track its identity from launch to launch. This
will usually modify the program on disk, and can happen without
apparent user input, e.g., when the Application Firewall first notices
that your program is trying to accept an inbound network connection.
If your program can be damaged by signing, it is imperative that you
ship a signed version as soon as practical. Programs signed by their
manufacturer are not modified in this way.

Perhaps your preference pane isn't signed?
___

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: data over USB to iPhone

2011-01-16 Thread Aaron Burghardt
Libimobiledevice is an open source project to replicate most of iTunes' 
functionality for managing devices. It has a lot of dependencies on other open 
source projects, though, so it takes some patience to build it:

 http://www.libimobiledevice.org/

usbmuxd is a small intermediary that multiplexes communication to the device, 
as the name implies, so that multiple clients (iTunes, Xcode, iPhoto, etc.), 
can access the device without contending for the USB interface. The project 
http://git.marcansoft.com/?p=usbmuxd.git includes a usbmuxd replacement and 
client library, as a starter.

However, these projects are all C-based and unsupported, so probably not 
appropriate for this list.

HTH,

Aaron


On Jan 16, 2011, at 6:05 PM, Georg Seifert wrote:

> Thanks for all the answers.
> Only to clarify. I don’t want to communicate from the iPhone to some device 
> but from the mac to the iPhone (as a divice).
> 
> I did find some mentions of usbmuxd, and that it allows communication over 
> USB. Does anyone know how to use it?
> 
> Best
> Georg
> 
> Am 14.01.2011 um 14:37 schrieb Thomas Engelmeier:
> 
>> 
>> On 13.01.2011, at 20:19, Kyle Sluder wrote:
>> 
>>> On Thu, Jan 13, 2011 at 11:12 AM, Reaves, Timothy
>>>  wrote:
 That's not correct.  There are Apple approved cables to allow you to do
 exactly that (there is a serial cable too).  But my understanding is the
 cable itself is not certified by Apple, but the actual usage of the cable.
 You you can get one of the existing cables and see if you can use it for
 your purpose, or contact the cable manufacturer, and see what they would
 charge to provide cables to you that are certified by Apple.
>>> 
>>> Are these cables part of the Made for iPhone program?
>>> 
>>> Aside from USB audio and keyboards, there's no out-of-the-box support
>>> for communicating over USB with the iOS SDK.
>> 
>> iPad iOS is able to work as an USB host for:
>> 
>> - MTP devices
>> - Mass Storage Devices
>> 
>> If you want to ship an app using that feature, filing an bug reports / 
>> feature request to "de-private" ImageCapture.framework makes sense ;-)
>> 
>> 
>> ___
>> 
>> 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/georg.seifert%40gmx.de
>> 
>> This email sent to georg.seif...@gmx.de
> 
> ___
> 
> 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/aaron.burghardt%40gmail.com
> 
> This email sent to aaron.burgha...@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


Parental Controls altering binary

2011-01-16 Thread Trygve Inda
When our app (actually a System Pref Pane) is run on a non-Admin account
with Parental Controls, it seems the binary is getting modified which causes
a checksum problem for verification of updates etc.

Has anyone else seen this?

Trygve


___

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


iOS: Question about split view

2011-01-16 Thread Phillip Mills
I see a problem with the following scenario:
1) Start with the template project for a split view
2) Add a function where a modal view can be shown over it using a style of 
UIModalPresentationFullScreen
3) Run in portrait mode
4) While the modal view is being shown, trigger a memory warning
5) Dismiss the modal view

The result is that the 'Events' button that brings up the popover root 
controller is no longer displayed.  The view has been reloaded, but the 
callback that sets up the 'Events' button hasn't been activated.

I'm handling this by saving a reference to the button the first time I'm given 
it and then,  in viewDidAppear:, checking for portrait orientation and the 
identity of the first item on the toolbar.  This feels like a hack.  Does 
anyone have a better strategy for this 
one?___

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: Get iphoto scripting bridge handle without starting iphoto?

2011-01-16 Thread Ken Ferry
My point was really that a developer should at the least be aware if he's using 
a hack. Unless this is a published interface, it's a hack that might break.

Apple is certainly able to do a dot rev of all the iLife apps simultaneously. 

-Ken

On Jan 16, 2011, at 1:48 PM, Graham Cox  wrote:

> I used parts of the iMedia browser (the objects that retrieve the images from 
> the iPhoto database) in an app that has been accepted on the App Store.
> 
> While I guess that the layout of the iPhoto database on disk could change, 
> all the iApps access it so if it changed they'd have to all be revved and 
> upgraded at once. Also, the way the layout works it's to a large extent 
> self-correcting - the 'master dictionary' contains full paths to the 
> individual files so provided those keys are still present in a changed 
> layout, the actual images will still be found.
> 
> --Graham
> 
> 
> On 17/01/2011, at 3:06 AM, Ken Ferry wrote:
> 
>> The project page does not make it clear whether or not that is a hack.  Is
>> that supported, or, for example, would you get rejected from the mac app
>> store for depending on stuff that changes between OS versions?
>> 
>> -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: data over USB to iPhone

2011-01-16 Thread Georg Seifert
Thanks for all the answers.
Only to clarify. I don’t want to communicate from the iPhone to some device but 
from the mac to the iPhone (as a divice).

I did find some mentions of usbmuxd, and that it allows communication over USB. 
Does anyone know how to use it?

Best
Georg

Am 14.01.2011 um 14:37 schrieb Thomas Engelmeier:

> 
> On 13.01.2011, at 20:19, Kyle Sluder wrote:
> 
>> On Thu, Jan 13, 2011 at 11:12 AM, Reaves, Timothy
>>  wrote:
>>> That's not correct.  There are Apple approved cables to allow you to do
>>> exactly that (there is a serial cable too).  But my understanding is the
>>> cable itself is not certified by Apple, but the actual usage of the cable.
>>> You you can get one of the existing cables and see if you can use it for
>>> your purpose, or contact the cable manufacturer, and see what they would
>>> charge to provide cables to you that are certified by Apple.
>> 
>> Are these cables part of the Made for iPhone program?
>> 
>> Aside from USB audio and keyboards, there's no out-of-the-box support
>> for communicating over USB with the iOS SDK.
> 
> iPad iOS is able to work as an USB host for:
> 
> - MTP devices
> - Mass Storage Devices
> 
> If you want to ship an app using that feature, filing an bug reports / 
> feature request to "de-private" ImageCapture.framework makes sense ;-)
> 
> 
> ___
> 
> 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/georg.seifert%40gmx.de
> 
> This email sent to georg.seif...@gmx.de

___

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: sending data to a view not yet displayed

2011-01-16 Thread Greg Guerin

Shane wrote:


So I guess my question is, how do I make sure my view is able to
receive the data I want sent to it before it is ever displayed. I hope
that makes sense.



Send the data to a Model, not a View.  If the View and Model are the  
same object, then the only way to have a Model is to have a View.


If you separate View from Model, then you can create a Model once (or  
whenever it's needed), and send it any data.  It then provides its  
data to any View that wants it, whenever the View wants it  
(typically, initialize the View from the Model's data in  
awakeFromNib).  If the View goes away (dealloc'ed), the Model  
remains.  Or if the Model represents a Document, the Model goes away,  
too.


To start making a separate Model, go through your View and  
ViewController classes and decide whether each method, property, or  
stateful item is part of the logical structure or the visible  
structure.  Logical structure is what the program represents  
regardless of how it's presented.  Visible structure is graphics,  
windows, etc.  If you change something in the logical structure, the  
program's capabilities change.  If you change something in the  
visible structure, that changes how it looks, but the capabilities  
are the same.


Example: you can have a huge visible structure consisting of dialogs,  
palettes, pickers, etc. for setting and applying a font to a single  
string of text.  The logical structure is much simpler: there is a  
chosen font and there is a single string the font is applied to.  The  
Model has a string and a font.  Everything else is part of the View  
and/or ViewController.


  -- GG

___

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

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

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

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


Re: Core Image increases memory use a lot

2011-01-16 Thread Nick Zitzmann

On Jan 16, 2011, at 2:43 PM, Graham Cox wrote:

> Who complains about a 30MB memory usage increase these days? Who even 
> notices? This is not Mac OS 9, it doesn't matter what your app's memory 
> footprint is (within reason).

Two kinds of people:

1. Experienced users that watch Activity Monitor like a hawk.

2. Unexperienced users that blame your program for slowing down their computer 
once its memory usage spikes and forces the OS to start swapping. Not everyone 
is literate enough to understand swapping, and since the OS outside of Activity 
Monitor gives the user no indication that this is going on (unless the disk is 
nearly full), then they need a scapegoat.

Using available memory is normally a good thing, since loading things from disk 
takes longer than accessing them from memory. But it is a balancing game, 
because using too much memory has negative side effects. So yes, it does 
matter, especially in 64-bit applications, since at least 32-bit apps will 
crash if they go overboard.

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: Core Image increases memory use a lot

2011-01-16 Thread Seth Willits
On Jan 16, 2011, at 1:43 PM, Graham Cox wrote:

>> It's not like I'm leaking any memory here, so why the large permanent 
>> increase? I'd like to avoid it if I can because I'm getting criticized for 
>> "using too much memory" despite it not being my fault. :-p
> 
> 
> Who complains about a 30MB memory usage increase these days? Who even 
> notices? This is not Mac OS 9, it doesn't matter what your app's memory 
> footprint is (within reason).

That's 30 MB for *a single image*. It happens multiple times and adds up. Who 
notices? Me, but also my customers (really). The recently released rewrite of 
my app QuickPick uses Core Animation and Core Image. It's a document and 
application launcher. Should it be using 150 MB? No. That's clearly excessive. 
Why is it using 150 MB? A little bit is my slight misuse of CA thinking it's 
smarter than it is, but almost 100 MB is just from using Core Image instead of 
Core Graphics.

If I remove just the blur filter, the memory usage isn't any lower. I can 
achieve the same effect (without the blur) using CG/NS and memory usage doesn't 
increase at all, as I would expect. 


> I expect Core Image is caching stuff for future use...

I have the same thought, but if I kill off the filter and every other 
CI-related object, I'd expect that to go away. Creating new filters and 
executing it again isn't significantly faster. 



--
Seth Willits



___

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

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

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

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


Re: Get iphoto scripting bridge handle without starting iphoto?

2011-01-16 Thread Graham Cox
I used parts of the iMedia browser (the objects that retrieve the images from 
the iPhoto database) in an app that has been accepted on the App Store.

While I guess that the layout of the iPhoto database on disk could change, all 
the iApps access it so if it changed they'd have to all be revved and upgraded 
at once. Also, the way the layout works it's to a large extent self-correcting 
- the 'master dictionary' contains full paths to the individual files so 
provided those keys are still present in a changed layout, the actual images 
will still be found.

--Graham


On 17/01/2011, at 3:06 AM, Ken Ferry wrote:

> The project page does not make it clear whether or not that is a hack.  Is
> that supported, or, for example, would you get rejected from the mac app
> store for depending on stuff that changes between OS versions?
> 
> -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: Why can't a modal view controller present another in viewDidLoad?

2011-01-16 Thread G S
On Sun, Jan 16, 2011 at 11:47 AM, Luke Hiesterman  wrote:
> viewDidLoad is called the first time the view property of the vc is accessed 
> - that's when loading happens. There is no guarantee that the view is in a 
> window at that time, and presenting a modal vc on a vc whose view is not in a 
> window does not make sense. Perhaps viewDidAppear is what you were looking 
> for. Where does the documentation say you can do this in viewDidLoad?

I should have clarified that; the doc says a modal view can invoke
another modal view, but the examples all have the user triggering it
with a button.  viewDidAppear sounds like a good candidate.  I'll give
it a try.

Thanks!
___

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

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

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

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


Re: Why can't a modal view controller present another in viewDidLoad?

2011-01-16 Thread Gustavo Pizano

On Jan 16, 2011, at 8:47 PM, Luke Hiesterman wrote:

> viewDidLoad is called the first time the view property of the vc is accessed 
> - that's when loading happens. There is no guarantee that the view is in a 
> window at that time, and presenting a modal vc on a vc whose view is not in a 
> window does not make sense. Perhaps viewDidAppear is what you were looking 
> for. Where does the documentation say you can do this in viewDidLoad?

I think he meant that you can put 2 modal views one on top of each other, not 
that he can load them from the viewDidLoad method.
G.

> 
> Luke
> 
> Sent from my iPhone.
> 
> On Jan 16, 2011, at 11:33 AM, G S  wrote:
> 
>> Hi all.
>> 
>> The Apple doc says this is possible, but it doesn't work when you want
>> the second modal view controller presented immediately.  If you
>> present a modal view controller that immediately presents another one
>> in its viewDidLoad method, the second one never shows up.  No errors
>> are reported, so what's going on?
>> 
>> A workaround I've seen people use (which does work) is to have the
>> ultimate parent instantiate all of the children's modal views, but
>> that requires every parent to determine (in advance) every view
>> controller in the hierarchy; obviously that's poor practice.  For
>> example, this works:
>> 
>>   [self presentModalViewController:newPictureController animated:NO];
>>   [self.newPictureController
>> presentModalViewController:newPictureController.picker animated:YES];
>> 
>> This makes it impossible to create controllers that manage their own
>> modal views upon instantiation.  Should the failure to show a modal
>> view controller from viewDidLoad be regarded as a bug in the SDK?
>> Anybody have a solution?
>> 
>> Thanks!
>> 
>> Gavin
>> ___
>> 
>> Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)
>> 
>> Please do not post admin requests or moderator comments to the list.
>> Contact the moderators at cocoa-dev-admins(at)lists.apple.com
>> 
>> Help/Unsubscribe/Update your Subscription:
>> http://lists.apple.com/mailman/options/cocoa-dev/luketheh%40apple.com
>> 
>> This email sent to luket...@apple.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/gustavxcodepicora%40gmail.com
> 
> This email sent to gustavxcodepic...@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: Core Image increases memory use a lot

2011-01-16 Thread Graham Cox

On 16/01/2011, at 8:03 PM, Seth Willits wrote:

> It's not like I'm leaking any memory here, so why the large permanent 
> increase? I'd like to avoid it if I can because I'm getting criticized for 
> "using too much memory" despite it not being my fault. :-p
> 


Who complains about a 30MB memory usage increase these days? Who even notices? 
This is not Mac OS 9, it doesn't matter what your app's memory footprint is 
(within reason).

I expect Core Image is caching stuff for future use - blurs for example are 
expensive to set up. Might be worth comparing the time taken to execute the 
first time this is called with subsequent times - if there's a worthwhile speed 
up you can claim it as a feature - classic speed vs. memory tradeoff.

--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: Core Image increases memory use a lot

2011-01-16 Thread Seth Willits



That's not applicable here. I'm not drawing many many things before returning 
to run loop so my memory usage isn't increasing due to repeated calls. It's 
just this single image. Just for giggles I tried it anyway, and as expected 
there's no difference at all.


--
Seth Willits






On Jan 16, 2011, at 5:32 AM, Jeff Johnson wrote:

> Hi Seth.
> 
> You might want to try putting an autorelease pool around your method. See the 
> "Tip" in this document:
> 
> https://developer.apple.com/library/mac/#documentation/GraphicsImaging/Conceptual/CoreImaging/ci_tasks/ci_tasks.html%23//apple_ref/doc/uid/TP30001185-CH203-TPXREF101
> 
> I've used this tip before to fix what appeared to be a memory leak in my app.
> 
> -Jeff
> 
> 
> On Jan 16, 2011, at 3:03 AM, Seth Willits wrote:
> 
>> I have a CALayer subclass and I'm drawing into it using Core Image. I'm 
>> taking a CGImage, blurring, and adding a darkened radial gradient on top of 
>> it. Pretty simple. Now the weird thing is, using Core Image for drawing this 
>> image (instead of just drawing with no effects using CGContextDrawImage) 
>> increases my app's memory usage by 30 MB. That almost doubles the entire 
>> usage of my app. 
>> 
>> It's not like I'm leaking any memory here, so why the large permanent 
>> increase? I'd like to avoid it if I can because I'm getting criticized for 
>> "using too much memory" despite it not being my fault. :-p
>> 
>> 
>> 
>>  - (void)drawInContext:(CGContextRef)theContext
>>  {
>>  CIImage * image = [CIImage 
>> imageWithCGImage:(CGImageRef)self.backgroundImage];
>>  CGRect imageRect = [image extent];
>>  
>>  CIFilter * blur = [CIFilter filterWithName:@"CIGaussianBlur"];
>>  [blur setValue:image forKey:@"inputImage"];
>>  [blur setValue:[NSNumber numberWithInt:2] 
>> forKey:@"inputRadius"];
>>  
>>  CIFilter * gradient = [CIFilter 
>> filterWithName:@"CIRadialGradient"];
>>  CGPoint center = CGPointMake(CGRectGetMidX(imageRect), 
>> CGRectGetMidY(imageRect));
>>  [gradient setValue:[CIVector vectorWithX:center.x Y:center.y]   
>> forKey:@"inputCenter"];
>>  [gradient setValue:[NSNumber numberWithInt:0.0] 
>> forKey:@"inputRadius0"];
>>  [gradient setValue:[NSNumber numberWithInt:600.0]   
>> forKey:@"inputRadius1"];
>>  [gradient setValue:[CIColor colorWithRed:0.0 green:0.0 blue:0.0 
>> alpha:0.3]  forKey:@"inputColor0"];
>>  [gradient setValue:[CIColor colorWithRed:0.0 green:0.0 blue:0.0 
>> alpha:0.6]  forKey:@"inputColor1"];
>>  
>>  CIContext * context = [CIContext 
>> contextWithCGContext:theContext options:NULL];
>>  CGRect extent = [image extent];
>>  [context drawImage:[blur valueForKey:@"outputImage"] 
>> inRect:self.bounds fromRect:extent];
>>  [context drawImage:[gradient valueForKey:@"outputImage"] 
>> inRect:self.bounds fromRect:extent];
>>  }
>> 
>> 
>> 
>> --
>> Seth Willits
> 
> 


___

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

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

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

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


Re: iPhoto "external editor"

2011-01-16 Thread Fritz Anderson
On 13 Jan 2011, at 7:06 PM, Greg Kennedy wrote:

> So my first problem is, how does iPhoto actually fire up an external editor 
> and pass the image or filename that it is interested in editing?

I'm sure it uses Launch Services. 
.
 Apple Events, your application delegate, and NSDocumentManager handle the rest.

I doubt this answers everything you meant to to ask. Perhaps you can refine 
your question for the list?

— F

___

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

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

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

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


Re: Why can't a modal view controller present another in viewDidLoad?

2011-01-16 Thread Luke Hiesterman
viewDidLoad is called the first time the view property of the vc is accessed - 
that's when loading happens. There is no guarantee that the view is in a window 
at that time, and presenting a modal vc on a vc whose view is not in a window 
does not make sense. Perhaps viewDidAppear is what you were looking for. Where 
does the documentation say you can do this in viewDidLoad?

Luke

Sent from my iPhone.

On Jan 16, 2011, at 11:33 AM, G S  wrote:

> Hi all.
> 
> The Apple doc says this is possible, but it doesn't work when you want
> the second modal view controller presented immediately.  If you
> present a modal view controller that immediately presents another one
> in its viewDidLoad method, the second one never shows up.  No errors
> are reported, so what's going on?
> 
> A workaround I've seen people use (which does work) is to have the
> ultimate parent instantiate all of the children's modal views, but
> that requires every parent to determine (in advance) every view
> controller in the hierarchy; obviously that's poor practice.  For
> example, this works:
> 
>[self presentModalViewController:newPictureController animated:NO];
>[self.newPictureController
> presentModalViewController:newPictureController.picker animated:YES];
> 
> This makes it impossible to create controllers that manage their own
> modal views upon instantiation.  Should the failure to show a modal
> view controller from viewDidLoad be regarded as a bug in the SDK?
> Anybody have a solution?
> 
> Thanks!
> 
> Gavin
> ___
> 
> Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)
> 
> Please do not post admin requests or moderator comments to the list.
> Contact the moderators at cocoa-dev-admins(at)lists.apple.com
> 
> Help/Unsubscribe/Update your Subscription:
> http://lists.apple.com/mailman/options/cocoa-dev/luketheh%40apple.com
> 
> This email sent to luket...@apple.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


Why can't a modal view controller present another in viewDidLoad?

2011-01-16 Thread G S
Hi all.

The Apple doc says this is possible, but it doesn't work when you want
the second modal view controller presented immediately.  If you
present a modal view controller that immediately presents another one
in its viewDidLoad method, the second one never shows up.  No errors
are reported, so what's going on?

A workaround I've seen people use (which does work) is to have the
ultimate parent instantiate all of the children's modal views, but
that requires every parent to determine (in advance) every view
controller in the hierarchy; obviously that's poor practice.  For
example, this works:

[self presentModalViewController:newPictureController animated:NO];
[self.newPictureController
presentModalViewController:newPictureController.picker animated:YES];

This makes it impossible to create controllers that manage their own
modal views upon instantiation.  Should the failure to show a modal
view controller from viewDidLoad be regarded as a bug in the SDK?
Anybody have a solution?

Thanks!

Gavin
___

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

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

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

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


Re: “EXC_BAD_ACCESS” object is not nil but not accessible

2011-01-16 Thread Kyle Sluder
On Jan 15, 2011, at 3:55 AM, Marco Frisan  wrote:

> I don't understand why _record.attributes causes a “EXC_BAD_ACCESS” signal.

This is the defining characteristic of a memory management bug: you have a 
pointer to an object that has since been freed. Trying to use that pointer is 
an error.

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


“EXC_BAD_ACCESS” object is not nil but not accessible

2011-01-16 Thread Marco Frisan
Hello all,

and thanks in advance for any help.

I am making a test application to play with files informations. The Xcode 
project file can be downloaded here VolumeList.zip 
(http://endercg.altervista.org/files/VolumeList.zip)

The application gets all the removable media volumes paths currently mounted on 
the system, using [[NSWorkspace sharedWorkspace] mountedRemovableMedia]. Then 
it creates and fill an object of class VLDiskItemRecord, for each path found, 
passing path and the display name of the item.
The list of items is displayed in a table view, showing display name (first 
column) and path (secondo column).
When I click on one item in the list its details (item attributes obtained with 
attributesOfItemAtPath: of the NSFileManager class) should be displayed in a 
details table view that shows the attribute name (first column) and the 
attribute value (second column).

The details table data source, uses 2 NSArray objects to cache the keys and the 
values of the attributes dictionary.

Though they seem to be not relevant since the application blocks for a 
“EXC_BAD_ACCESS” signal a little before to initialize them, in the body of the 
numberOfRowsInTableView: of the details table data source 
(VLVolumeDetailsViewController), when I try to get the attributes dictionary 
with a call to the property _record.attributes.

If I roll over the _record variable, while application i still blocked at that 
point and with debugger active, and I expand hits content, I get:

Cannot access memory at address 0x7043c748

Though the object pointed by _record has address 0x103141230, hand its members 
have addresses: 0x10313f760, 0x10313f5f0 and 0x10313f780 (the last one is the 
attributes dictionary).

I don't understand why _record.attributes causes a “EXC_BAD_ACCESS” signal.


This is the output:

2011-01-15 12:19:28.506 VolumesList[315:a0f] -[VLVolumeDetailsViewController 
init]
2011-01-15 12:19:28.508 VolumesList[315:a0f] -[VLVolumesListViewController init]
2011-01-15 12:19:28.521 VolumesList[315:a0f] -[VLVolumesListViewController 
numberOfRowsInTableView:]
2011-01-15 12:19:28.584 VolumesList[315:a0f] -[VLVolumeDetailsViewController 
numberOfRowsInTableView:]
2011-01-15 12:19:28.606 VolumesList[315:a0f] -[VLVolumesListViewController load]
2011-01-15 12:19:28.606 VolumesList[315:a0f] media = (
"/Volumes/18042004"
)
2011-01-15 12:19:28.607 VolumesList[315:a0f] -[VLDiskItemRecord 
initWithName:mountPoint:]
2011-01-15 12:19:28.607 VolumesList[315:a0f] -[VLDiskItemRecord initAttributes]
2011-01-15 12:19:28.608 VolumesList[315:a0f] Record: ; name: 18042004; path: /Volumes/18042004
2011-01-15 12:19:28.608 VolumesList[315:a0f] _records is nil, initialize it! ...
2011-01-15 12:19:28.608 VolumesList[315:a0f] _records initialized with object (
)
2011-01-15 12:19:28.608 VolumesList[315:a0f] _records count: 1
2011-01-15 12:19:28.609 VolumesList[315:a0f] -[VLVolumesListViewController 
numberOfRowsInTableView:]
2011-01-15 12:19:28.610 VolumesList[315:a0f] -[VLVolumesListViewController 
tableView:objectValueForTableColumn:row:]
2011-01-15 12:19:28.610 VolumesList[315:a0f] -[VLVolumesListViewController 
tableView:objectValueForTableColumn:row:]
2011-01-15 12:19:28.613 VolumesList[315:a0f] -[VLVolumesListViewController 
tableView:objectValueForTableColumn:row:]
2011-01-15 12:19:28.614 VolumesList[315:a0f] -[VLVolumesListViewController 
tableView:objectValueForTableColumn:row:]
2011-01-15 12:19:32.931 VolumesList[315:a0f] -[VLVolumesListViewController 
tableView:objectValueForTableColumn:row:]
2011-01-15 12:19:32.932 VolumesList[315:a0f] -[VLVolumesListViewController 
tableView:objectValueForTableColumn:row:]
2011-01-15 12:19:34.498 VolumesList[315:a0f] -[VLVolumesListViewController 
tableView:objectValueForTableColumn:row:]
2011-01-15 12:19:34.499 VolumesList[315:a0f] -[VLVolumesListViewController 
tableView:objectValueForTableColumn:row:]
2011-01-15 12:19:34.501 VolumesList[315:a0f] -[VLVolumesListViewController 
tableView:objectValueForTableColumn:row:]
2011-01-15 12:19:34.502 VolumesList[315:a0f] -[VLVolumesListViewController 
tableView:objectValueForTableColumn:row:]
2011-01-15 12:19:34.562 VolumesList[315:a0f] -[VLVolumesListViewController 
tableViewSelectionDidChange:]
(gdb) continue
Current language:  auto; currently objective-c
2011-01-15 12:19:39.401 VolumesList[315:a0f] -[VLVolumeDetailsViewController 
setRecord:]
2011-01-15 12:19:39.401 VolumesList[315:a0f] -[VLVolumeDetailsViewController 
numberOfRowsInTableView:]
Program received signal:  “EXC_BAD_ACCESS”.


___

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: Get iphoto scripting bridge handle without starting iphoto?

2011-01-16 Thread Ken Ferry
The project page does not make it clear whether or not that is a hack.  Is
that supported, or, for example, would you get rejected from the mac app
store for depending on stuff that changes between OS versions?

-Ken

On Sun, Jan 16, 2011 at 4:07 AM, Mike Abdullah wrote:

> Use the iMedia Browser to parse the library without launching iPhoto.
> http://code.google.com/p/imedia/
>
> On 14 Jan 2011, at 18:10, Gabriel Zachmann wrote:
>
> > My question is: can I get a scripting bridge handle on iPhoto without
> making iPhoto launch?
> > And can I retrieve a list of iPhoto albums and a list of images in an
> album without making iPhoto launch?
> >
> > Right now, I am using
> >  iPhoto_ = [[SBApplication 
> > applicationWithBundleIdentifier:@"com.apple.iPhoto"]
> retain];
> > but that fires up iPhoto, which can be a bit slow.
> > Also, as a user, I find it a bit disturbing that iPhoto has been launched
> by another program.
> >
> >
> > Best regards,
> > Gabriel.
> >
> > ___
> >
> > Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)
> >
> > Please do not post admin requests or moderator comments to the list.
> > Contact the moderators at cocoa-dev-admins(at)lists.apple.com
> >
> > Help/Unsubscribe/Update your Subscription:
> >
> http://lists.apple.com/mailman/options/cocoa-dev/cocoadev%40mikeabdullah.net
> >
> > This email sent to cocoa...@mikeabdullah.net
>
> ___
>
> Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)
>
> Please do not post admin requests or moderator comments to the list.
> Contact the moderators at cocoa-dev-admins(at)lists.apple.com
>
> Help/Unsubscribe/Update your Subscription:
> http://lists.apple.com/mailman/options/cocoa-dev/kenferry%40gmail.com
>
> This email sent to kenfe...@gmail.com
>
___

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

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

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

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


Re: Core Image increases memory use a lot

2011-01-16 Thread Jeff Johnson
Hi Seth.

You might want to try putting an autorelease pool around your method. See the 
"Tip" in this document:

https://developer.apple.com/library/mac/#documentation/GraphicsImaging/Conceptual/CoreImaging/ci_tasks/ci_tasks.html%23//apple_ref/doc/uid/TP30001185-CH203-TPXREF101

I've used this tip before to fix what appeared to be a memory leak in my app.

-Jeff


On Jan 16, 2011, at 3:03 AM, Seth Willits wrote:

> I have a CALayer subclass and I'm drawing into it using Core Image. I'm 
> taking a CGImage, blurring, and adding a darkened radial gradient on top of 
> it. Pretty simple. Now the weird thing is, using Core Image for drawing this 
> image (instead of just drawing with no effects using CGContextDrawImage) 
> increases my app's memory usage by 30 MB. That almost doubles the entire 
> usage of my app. 
> 
> It's not like I'm leaking any memory here, so why the large permanent 
> increase? I'd like to avoid it if I can because I'm getting criticized for 
> "using too much memory" despite it not being my fault. :-p
> 
> 
> 
>   - (void)drawInContext:(CGContextRef)theContext
>   {
>   CIImage * image = [CIImage 
> imageWithCGImage:(CGImageRef)self.backgroundImage];
>   CGRect imageRect = [image extent];
>   
>   CIFilter * blur = [CIFilter filterWithName:@"CIGaussianBlur"];
>   [blur setValue:image forKey:@"inputImage"];
>   [blur setValue:[NSNumber numberWithInt:2] 
> forKey:@"inputRadius"];
>   
>   CIFilter * gradient = [CIFilter 
> filterWithName:@"CIRadialGradient"];
>   CGPoint center = CGPointMake(CGRectGetMidX(imageRect), 
> CGRectGetMidY(imageRect));
>   [gradient setValue:[CIVector vectorWithX:center.x Y:center.y]   
> forKey:@"inputCenter"];
>   [gradient setValue:[NSNumber numberWithInt:0.0] 
> forKey:@"inputRadius0"];
>   [gradient setValue:[NSNumber numberWithInt:600.0]   
> forKey:@"inputRadius1"];
>   [gradient setValue:[CIColor colorWithRed:0.0 green:0.0 blue:0.0 
> alpha:0.3]  forKey:@"inputColor0"];
>   [gradient setValue:[CIColor colorWithRed:0.0 green:0.0 blue:0.0 
> alpha:0.6]  forKey:@"inputColor1"];
>   
>   CIContext * context = [CIContext 
> contextWithCGContext:theContext options:NULL];
>   CGRect extent = [image extent];
>   [context drawImage:[blur valueForKey:@"outputImage"] 
> inRect:self.bounds fromRect:extent];
>   [context drawImage:[gradient valueForKey:@"outputImage"] 
> inRect:self.bounds fromRect:extent];
>   }
> 
> 
> 
> --
> Seth Willits

___

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

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

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

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


Re: Get iphoto scripting bridge handle without starting iphoto?

2011-01-16 Thread Mike Abdullah
Use the iMedia Browser to parse the library without launching iPhoto.
http://code.google.com/p/imedia/

On 14 Jan 2011, at 18:10, Gabriel Zachmann wrote:

> My question is: can I get a scripting bridge handle on iPhoto without making 
> iPhoto launch?
> And can I retrieve a list of iPhoto albums and a list of images in an album 
> without making iPhoto launch?
> 
> Right now, I am using 
>  iPhoto_ = [[SBApplication 
> applicationWithBundleIdentifier:@"com.apple.iPhoto"] retain];
> but that fires up iPhoto, which can be a bit slow.
> Also, as a user, I find it a bit disturbing that iPhoto has been launched by 
> another program.
> 
> 
> Best regards,
> Gabriel.
> 
> ___
> 
> Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)
> 
> Please do not post admin requests or moderator comments to the list.
> Contact the moderators at cocoa-dev-admins(at)lists.apple.com
> 
> Help/Unsubscribe/Update your Subscription:
> http://lists.apple.com/mailman/options/cocoa-dev/cocoadev%40mikeabdullah.net
> 
> This email sent to cocoa...@mikeabdullah.net

___

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

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

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

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


Core Image increases memory use a lot

2011-01-16 Thread Seth Willits


I have a CALayer subclass and I'm drawing into it using Core Image. I'm taking 
a CGImage, blurring, and adding a darkened radial gradient on top of it. Pretty 
simple. Now the weird thing is, using Core Image for drawing this image 
(instead of just drawing with no effects using CGContextDrawImage) increases my 
app's memory usage by 30 MB. That almost doubles the entire usage of my app. 

It's not like I'm leaking any memory here, so why the large permanent increase? 
I'd like to avoid it if I can because I'm getting criticized for "using too 
much memory" despite it not being my fault. :-p



- (void)drawInContext:(CGContextRef)theContext
{
CIImage * image = [CIImage 
imageWithCGImage:(CGImageRef)self.backgroundImage];
CGRect imageRect = [image extent];

CIFilter * blur = [CIFilter filterWithName:@"CIGaussianBlur"];
[blur setValue:image forKey:@"inputImage"];
[blur setValue:[NSNumber numberWithInt:2] 
forKey:@"inputRadius"];

CIFilter * gradient = [CIFilter 
filterWithName:@"CIRadialGradient"];
CGPoint center = CGPointMake(CGRectGetMidX(imageRect), 
CGRectGetMidY(imageRect));
[gradient setValue:[CIVector vectorWithX:center.x Y:center.y]   
forKey:@"inputCenter"];
[gradient setValue:[NSNumber numberWithInt:0.0] 
forKey:@"inputRadius0"];
[gradient setValue:[NSNumber numberWithInt:600.0]   
forKey:@"inputRadius1"];
[gradient setValue:[CIColor colorWithRed:0.0 green:0.0 blue:0.0 
alpha:0.3]  forKey:@"inputColor0"];
[gradient setValue:[CIColor colorWithRed:0.0 green:0.0 blue:0.0 
alpha:0.6]  forKey:@"inputColor1"];

CIContext * context = [CIContext 
contextWithCGContext:theContext options:NULL];
CGRect extent = [image extent];
[context drawImage:[blur valueForKey:@"outputImage"] 
inRect:self.bounds fromRect:extent];
[context drawImage:[gradient valueForKey:@"outputImage"] 
inRect:self.bounds fromRect:extent];
}



--
Seth Willits



___

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

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

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

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