NSClassDescriptionNeededForClassNotification

2011-03-21 Thread Kevin Bracey
Hi there,

I hope that I could "register class descriptions lazily", I like doing most 
things lazily.

But I can't find where or how to listen for the 
NSClassDescriptionNeededForClassNotification.

I've place [[NSNotificationCenter defaultCenter] addObserver:self 
selector:@selector( registerClassDescription: ) 
name:NSClassDescriptionNeededForClassNotification object:nil]; in either my 
AppDelegate and my model object.

It just doesn't seem to fire when  classDescriptionForClass: does not find a 
class.

I have fired it manually with [[NSNotificationCenter defaultCenter] 
postNotificationName:NSClassDescriptionNeededForClassNotification object:self]; 
and my 
- (void)registerClassDescription:( NSNotification *)aNotification
{
NSLog(@"Looking for Notification" );
}

logs fine. 

Can any shed some light on where and how to get notified of 
NSClassDescriptionNeededForClassNotification?

cheers
Kevin___

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

Please do not post 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


UITabBarController calls viewDidAppear

2011-03-21 Thread Remco Poelstra
Hi,

I've a UITabBarController. with two tabs, that's loaded from the 
MainWindow.xib. It's UINavigationControllers are in the same NIB, which load 
their UITableViewControllers from external NIB's (as recommended by Apple).
The tableview in the first tab loads in its tableView:didSelectRowAtIndexPath 
the same tableview as the second would (but with different properties). This is 
the same behaviour as the iPod application, where the artist tableview loads an 
album view, but you can also show albums from the tab bar controller (showing a 
different set of albums).
When the second tableview is loaded from the first tableview, everything works 
fine. When the second tableview is loaded directly in the second tab, 
viewDidAppear is called long before the view is shown. The tableView therefore 
did not have time to fully initialize (and call numberOfRowsInSection:) and 
crashes on a wrong row insert command in viewDidAppear.

How can I find out why the viewDidAppear is called to early?

Kind regards,

Remco Poelstra
___

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

Please do not post 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: Exception not being caught

2011-03-21 Thread jonat...@mugginsoft.com

On 21 Mar 2011, at 04:11, Rick Mann wrote:

>> Can you give us the exception report?
>> Is it an NSException instance?
> 
> Yes. It is raised by this line of code:
> 
>[NSException raise:NSInvalidArchiveOperationException format:@"Network 
> error domain:%@ code:%d", [requestError domain], [requestError code]];
As you are raising the exception then you could try raising the exception 
experimentally when the operation starts to help source the problem.
You mentioned break points earlier. What happens when the code runs outside of 
the development environment.

> 
>> This might indicate that your exception is not occurring on your main thread.
> 
> It is most certainly NOT occurring on the main thread. Never said it was (in 
> fact, I figured the bit about NSOperation would imply it was not).
> 
Now we know.
Have you tried using NSExceptionHandler? It might provide some insight.

If the problem persists you could post more code.

If it's a fundamental issue it should be demonstrable in a short test project.

Regards

Jonathan Mitchell

Developer
Mugginsoft LLP
http://www.mugginsoft.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


UIWebView HTML to match UITextView

2011-03-21 Thread BareFeetWare
Hi all,

I'm trying to show text in a UIWebView to match exactly how it appears in a 
UITextView. Is there a standard library or subclass to do this?

I've got it mostly working, by programmatically implementing what is basically 
a copy of the HTML syntax produced by TextEdit. But a few things like periods 
"." and parentheses "()" seem to use slightly different horizontal spacing 
(which creates a cumulative misalignment), and line wraps start in a different 
location.

Thanks,
Tom
BareFeetWare

___

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

Please do not post 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


HTML Writer class

2011-03-21 Thread Philip Vallone
Hi list,

Is there a Cocoa Touch class for creating HTML documents? For example, in C# 
there is the HTMLDoument class.  I searched the reference docs, but came up 
empty. 

Regards,

Phil

___

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

Please do not post 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


Edit NSScrollView text

2011-03-21 Thread Leonardo
Hi,
on XCode version 3 I was able to launch IB and edit the text of a
NSScrollView. On XCode 4 I can't. And even if I modify this text, which is
saved within the file MainMenu.nib/keyedobjects.nib
when I relaunch XCode 4 and open my project file, the change doesn't show
up. I always see the old text.

Also, I have seen that even creating a new NSScrollView, I can't edit the
text. So, my question is, how can I edit the text of a NSScrollView when
editing a nib file? I found it very useful, especially to create a license
panel.


Regards
-- Leonardo


___

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

Please do not post 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: HTML Writer class

2011-03-21 Thread Mike Abdullah
https://github.com/karelia/KSHTMLWriter
Standard BSD license

On 21 Mar 2011, at 13:04, Philip Vallone wrote:

> Hi list,
> 
> Is there a Cocoa Touch class for creating HTML documents? For example, in C# 
> there is the HTMLDoument class.  I searched the reference docs, but came up 
> empty. 
> 
> Regards,
> 
> Phil
> 
> ___
> 
> Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)
> 
> Please do not post 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


TweenTrack working on QT10

2011-03-21 Thread Leonardo
Hi,
if I add a Tween Track to my QT movie, I end up with a movie file requiring
QT7 and not working on QT10. If I don't add the tween track, QT10 can open
the movie. So the difference is the Tween Track.
However Safari 5.0.3 can play the movie with the Tween Track and I can
properly hear the volume decreasing. So the Tween Track works well.
Is anyone who knows how to create a Tween Track working on QT10?
I do:


  scale = GetMovieTimeScale(_movie);
  tweenTrack = NewMovieTrack(_movie, 0, 0, kNoVolume);
  tweenMedia = NewTrackMedia(tweenTrack, TweenMediaType,  scale nil,  0);

  BeginMediaEdits(tweenMedia);
  ...
  AddTweenSampleToMedia2(tweenMedia, rampOffset, rampDur, lastVol, thisVol);
  ...
  EndMediaEdits(tweenMedia);

  InsertMediaIntoTrack(tweenTrack, insPoint, 0, tweenDuration, fixed1);
  QTNewAtomContainer(&inputMap);
  AddTrackReference(mySndTrack, tweenTrack, kTrackModifierReference,
&referenceIndex);
  QTInsertChild(inputMap, kParentAtomIsContainer, kTrackModifierInput,
referenceIndex, 0, 0, nil, &inputAtom);

  OSType inputType = EndianU32_NtoB(kTrackModifierTypeVolume);
  QTInsertChild(inputMap, inputAtom, kTrackModifierType, 1, 0,
sizeof(inputType), &inputType, nil);

  long tweenID = EndianU32_NtoB(1);
  QTInsertChild(inputMap, inputAtom, kInputMapSubInputID, 1, 0,
sizeof(tweenID), &tweenID, nil);

  err = SetMediaInputMap(GetTrackMedia(mySndTrack), inputMap);
  if(err != noErr) return err;

  QTDisposeAtomContainer(inputMap);



Regards
-- Leonardo


___

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

Please do not post 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: Exception not being caught

2011-03-21 Thread Rick Mann

On Mar 21, 2011, at 2:50 AM, jonat...@mugginsoft.com wrote:

> As you are raising the exception then you could try raising the exception 
> experimentally when the operation starts to help source the problem.
> You mentioned break points earlier. What happens when the code runs outside 
> of the development environment.

Without the breakpoint, the network pipe doesn't break, and it runs fine. I'll 
try raising the exception deliberately.

> Have you tried using NSExceptionHandler? It might provide some insight.

That appears to be a Mac OS X-only facility, and I failed to mention this was 
iOS.

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


Popover Shrinks beyond Indicator

2011-03-21 Thread Gordon Apple
I have a popover with a navigation controller, which launches from a button
near the right side of (and at toe top of) the screen.  Subsequent smaller
panels within the popover downsize correctly, but resizing is always by
moving in the right side of the popover, often beyond the anchor point for
the popover, in which case the indicator arrow no longer points to the
anchor point because the popover is then too narrow.  Is there any way to
fix this?

___

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

Please do not post 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: Popover Shrinks beyond Indicator

2011-03-21 Thread Corbin Dunn
Hi Gordon,

On Mar 21, 2011, at 12:34 PM, Gordon Apple wrote:

> I have a popover with a navigation controller, which launches from a button
> near the right side of (and at toe top of) the screen.  Subsequent smaller
> panels within the popover downsize correctly, but resizing is always by
> moving in the right side of the popover, often beyond the anchor point for
> the popover, in which case the indicator arrow no longer points to the
> anchor point because the popover is then too narrow.  Is there any way to
> fix this?
> 

Popovers are a Lion feature which can not be discussed here on the public 
mailing list. Please post questions on popovers to the preview developer forum 
page.

You could be talking about UIPopover, but your post was non-specific.

--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: Exception not being caught

2011-03-21 Thread Greg Parker
On Mar 20, 2011, at 9:11 PM, Rick Mann wrote:
> On Mar 20, 2011, at 12:45 PM, jonat...@mugginsoft.com wrote:
>> On 20 Mar 2011, at 19:17, Rick Mann wrote:
>>> I have some code, called from a subclass of NSOperation, that throws an 
>>> exception pretty reliably if I put a breakpoint elsewhere in the code (it 
>>> is code that does an HTTP request, and it's getting a broken pipe, and 
>>> raising an exception to report it; the breakpoint (in another thread) seems 
>>> to trigger this behavior).
>>> 
>>> My NSOperation subclass wraps the call to the network code in a @try/catch 
>>> block. But when this exception is raised, the app terminates due to an 
>>> uncaught exception.
> 
> 2011-03-20 18:41:13.233 MissionClock[17979:7e03] *** Terminating app due to 
> uncaught exception 'NSInvalidArchiveOperationException', reason: 'Network 
> error domain:NSURLErrorDomain code:-1005'
> *** Call stack at first throw:
> (
>   0   CoreFoundation  0x015be5a9 
> __exceptionPreprocess + 185
>   1   libobjc.A.dylib 0x01712313 objc_exception_throw 
> + 44
>   2   CoreFoundation  0x01576ef8 +[NSException 
> raise:format:arguments:] + 136
>   3   CoreFoundation  0x01576e6a +[NSException 
> raise:format:] + 58
>   4   MissionClock0x00010920 
> -[CWDistantHessianObject(Private) sendRequestWithPostData:] + 426
>   5   MissionClock0x000115ad 
> -[CWDistantHessianObject forwardInvocation:] + 77
>   6   CoreFoundation  0x0152fa04 ___forwarding___ + 
> 1124
>   7   CoreFoundation  0x0152f522 
> _CF_forwarding_prep_0 + 50
>   8   MissionClock0x0001aef8 -[GetMissionListOp 
> main] + 722
>   9   Foundation  0x00128b76 
> -[__NSOperationInternal start] + 747
>   10  Foundation  0x001287ca 
> startOperations_block_invoke_2 + 106
>   11  libdispatch_sim.dylib   0x01bf1289 
> _dispatch_call_block_and_release + 16
>   12  libdispatch_sim.dylib   0x01bf458a 
> _dispatch_worker_thread2 + 252
>   13  libSystem.B.dylib   0x92b46d41 _pthread_wqthread + 
> 390
>   14  libSystem.B.dylib   0x92b46b86 start_wqthread + 30
> )

You can't currently throw an exception across a forwarded call. When the 
exception unwinder hits the forwarding frame, it stops and the exception goes 
uncaught. You'll need to put your exception handler at a different level.


-- 
Greg Parker gpar...@apple.com Runtime Wrangler


___

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

Please do not post 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


MPMoviePlayerController setContentURL twice

2011-03-21 Thread Heath Borders
I create an embedded MPMoviePlayerController thusly inside my loadView method:

self.moviePlayerController = [[[MPMoviePlayerController alloc] init]
autorelease];

// add to view, setup moviePlayerController's view frame, etc

And I can later load a movie the user chooses thusly:

NSURL *fileUrl = ...
self.moviePlayerController.contentURL = fileUrl;

and everything works great.


However, if I set the contentURL again:

NSURL *fileUrl2 = ...
self.moviePlayerController.contentURL = fileUrl2;

This does not work, even if fileUrl2 == fileUrl1.

When I change the contentURL, I get the following playbackState and loadState:

After first setContentURL:
loadState == playable | playthroughOK
playbackState == playing

After my second setContentURL:
playbackState == stopped
loadState == unknown

I can of course create a new MPMoviePlayerController for every movie,
but I want to make sure this issue isn't indicative of a larger
problem.

Thanks!

-Heath Borders
heath.bord...@gmail.com
Twitter: heathborders
http://heath-tech.blogspot.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: Exception not being caught

2011-03-21 Thread Rick Mann

On Mar 21, 2011, at 2:03 PM, Greg Parker wrote:

> On Mar 20, 2011, at 9:11 PM, Rick Mann wrote:
>> On Mar 20, 2011, at 12:45 PM, jonat...@mugginsoft.com wrote:
>>> On 20 Mar 2011, at 19:17, Rick Mann wrote:
 I have some code, called from a subclass of NSOperation, that throws an 
 exception pretty reliably if I put a breakpoint elsewhere in the code (it 
 is code that does an HTTP request, and it's getting a broken pipe, and 
 raising an exception to report it; the breakpoint (in another thread) 
 seems to trigger this behavior).
 
 My NSOperation subclass wraps the call to the network code in a @try/catch 
 block. But when this exception is raised, the app terminates due to an 
 uncaught exception.
>> 
>> 2011-03-20 18:41:13.233 MissionClock[17979:7e03] *** Terminating app due to 
>> uncaught exception 'NSInvalidArchiveOperationException', reason: 'Network 
>> error domain:NSURLErrorDomain code:-1005'
>> *** Call stack at first throw:
>> (
>>  0   CoreFoundation  0x015be5a9 
>> __exceptionPreprocess + 185
>>  1   libobjc.A.dylib 0x01712313 objc_exception_throw 
>> + 44
>>  2   CoreFoundation  0x01576ef8 +[NSException 
>> raise:format:arguments:] + 136
>>  3   CoreFoundation  0x01576e6a +[NSException 
>> raise:format:] + 58
>>  4   MissionClock0x00010920 
>> -[CWDistantHessianObject(Private) sendRequestWithPostData:] + 426
>>  5   MissionClock0x000115ad 
>> -[CWDistantHessianObject forwardInvocation:] + 77
>>  6   CoreFoundation  0x0152fa04 ___forwarding___ + 
>> 1124
>>  7   CoreFoundation  0x0152f522 
>> _CF_forwarding_prep_0 + 50
>>  8   MissionClock0x0001aef8 -[GetMissionListOp 
>> main] + 722
>>  9   Foundation  0x00128b76 
>> -[__NSOperationInternal start] + 747
>>  10  Foundation  0x001287ca 
>> startOperations_block_invoke_2 + 106
>>  11  libdispatch_sim.dylib   0x01bf1289 
>> _dispatch_call_block_and_release + 16
>>  12  libdispatch_sim.dylib   0x01bf458a 
>> _dispatch_worker_thread2 + 252
>>  13  libSystem.B.dylib   0x92b46d41 _pthread_wqthread + 
>> 390
>>  14  libSystem.B.dylib   0x92b46b86 start_wqthread + 30
>> )
> 
> You can't currently throw an exception across a forwarded call. When the 
> exception unwinder hits the forwarding frame, it stops and the exception goes 
> uncaught. You'll need to put your exception handler at a different level.

Thanks for the info, Greg! I hope I can find a place to put the handler.

-- 
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: Exception not being caught

2011-03-21 Thread Kyle Sluder
On Mon, Mar 21, 2011 at 2:03 PM, Greg Parker  wrote:
> You can't currently throw an exception across a forwarded call. When the 
> exception unwinder hits the forwarding frame, it stops and the exception goes 
> uncaught. You'll need to put your exception handler at a different level.

Does this limitation exist on the desktop as well?

--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: Exception not being caught

2011-03-21 Thread Greg Parker
On Mar 21, 2011, at 2:06 PM, Kyle Sluder wrote:
> On Mon, Mar 21, 2011 at 2:03 PM, Greg Parker  wrote:
>> You can't currently throw an exception across a forwarded call. When the 
>> exception unwinder hits the forwarding frame, it stops and the exception 
>> goes uncaught. You'll need to put your exception handler at a different 
>> level.
> 
> Does this limitation exist on the desktop as well?

I'm pretty sure it fails on any platform that uses the modern ABI (iOS and 
64-bit Mac), but I can't find the bug report at the moment.

(The problem is that the forwarding machinery is hand-written assembly, and 
nobody added hand-written exception unwind tables to match. With "zero-cost" 
exceptions, the unwinder cannot process a frame without its unwind tables.)


-- 
Greg Parker gpar...@apple.com Runtime Wrangler


___

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

Please do not post 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: Exception not being caught

2011-03-21 Thread Rick Mann

On Mar 21, 2011, at 2:03 PM, Greg Parker wrote:

> On Mar 20, 2011, at 9:11 PM, Rick Mann wrote:
>> On Mar 20, 2011, at 12:45 PM, jonat...@mugginsoft.com wrote:
>>> On 20 Mar 2011, at 19:17, Rick Mann wrote:
 I have some code, called from a subclass of NSOperation, that throws an 
 exception pretty reliably if I put a breakpoint elsewhere in the code (it 
 is code that does an HTTP request, and it's getting a broken pipe, and 
 raising an exception to report it; the breakpoint (in another thread) 
 seems to trigger this behavior).
 
 My NSOperation subclass wraps the call to the network code in a @try/catch 
 block. But when this exception is raised, the app terminates due to an 
 uncaught exception.
>> 
>> 2011-03-20 18:41:13.233 MissionClock[17979:7e03] *** Terminating app due to 
>> uncaught exception 'NSInvalidArchiveOperationException', reason: 'Network 
>> error domain:NSURLErrorDomain code:-1005'
>> *** Call stack at first throw:
>> (
>>  0   CoreFoundation  0x015be5a9 
>> __exceptionPreprocess + 185
>>  1   libobjc.A.dylib 0x01712313 objc_exception_throw 
>> + 44
>>  2   CoreFoundation  0x01576ef8 +[NSException 
>> raise:format:arguments:] + 136
>>  3   CoreFoundation  0x01576e6a +[NSException 
>> raise:format:] + 58
>>  4   MissionClock0x00010920 
>> -[CWDistantHessianObject(Private) sendRequestWithPostData:] + 426
>>  5   MissionClock0x000115ad 
>> -[CWDistantHessianObject forwardInvocation:] + 77
>>  6   CoreFoundation  0x0152fa04 ___forwarding___ + 
>> 1124
>>  7   CoreFoundation  0x0152f522 
>> _CF_forwarding_prep_0 + 50
>>  8   MissionClock0x0001aef8 -[GetMissionListOp 
>> main] + 722
>>  9   Foundation  0x00128b76 
>> -[__NSOperationInternal start] + 747
>>  10  Foundation  0x001287ca 
>> startOperations_block_invoke_2 + 106
>>  11  libdispatch_sim.dylib   0x01bf1289 
>> _dispatch_call_block_and_release + 16
>>  12  libdispatch_sim.dylib   0x01bf458a 
>> _dispatch_worker_thread2 + 252
>>  13  libSystem.B.dylib   0x92b46d41 _pthread_wqthread + 
>> 390
>>  14  libSystem.B.dylib   0x92b46b86 start_wqthread + 30
>> )
> 
> You can't currently throw an exception across a forwarded call. When the 
> exception unwinder hits the forwarding frame, it stops and the exception goes 
> uncaught. You'll need to put your exception handler at a different level.

Hrm. This is actually a bit of a pickle. HessianKit implements the Hessian RPC 
API. It does so by having the client declare a protocol (and a mapping from 
Obj-C-to-Java method signatures), and the providing an implementation for the 
selector. In this case, my code is actually calling a selector that results in 
an invocation of a method on my server.

There really is no place for me to put an exception handler. I could modify 
HessianKit, and trap exceptions in the forwarding code, but there's no way to 
report the error back to my calling code.

-- 
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: Exception not being caught

2011-03-21 Thread Rick Mann

On Mar 21, 2011, at 2:19 PM, Greg Parker wrote:

> On Mar 21, 2011, at 2:06 PM, Kyle Sluder wrote:
>> On Mon, Mar 21, 2011 at 2:03 PM, Greg Parker  wrote:
>>> You can't currently throw an exception across a forwarded call. When the 
>>> exception unwinder hits the forwarding frame, it stops and the exception 
>>> goes uncaught. You'll need to put your exception handler at a different 
>>> level.
>> 
>> Does this limitation exist on the desktop as well?
> 
> I'm pretty sure it fails on any platform that uses the modern ABI (iOS and 
> 64-bit Mac), but I can't find the bug report at the moment.
> 
> (The problem is that the forwarding machinery is hand-written assembly, and 
> nobody added hand-written exception unwind tables to match. With "zero-cost" 
> exceptions, the unwinder cannot process a frame without its unwind tables.)

I just reported a new bug for it:

 9164577

Thanks,
-- 
Rick


___

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

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

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

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


Re: Exception not being caught

2011-03-21 Thread Laurent Daudelin
On Mar 21, 2011, at 14:19, Greg Parker wrote:

> (The problem is that the forwarding machinery is hand-written assembly, and 
> nobody added hand-written exception unwind tables to match. With "zero-cost" 
> exceptions, the unwinder cannot process a frame without its unwind tables.)

Hand-written assembly? Really?

-Laurent.
-- 
Laurent Daudelin
AIM/iChat/Skype:LaurentDaudelin 
http://www.nemesys-soft.com/
Logiciels Nemesys Software  
laur...@nemesys-soft.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: Exception not being caught

2011-03-21 Thread Greg Parker
On Mar 21, 2011, at 2:43 PM, Laurent Daudelin wrote:
> On Mar 21, 2011, at 14:19, Greg Parker wrote:
>> (The problem is that the forwarding machinery is hand-written assembly, and 
>> nobody added hand-written exception unwind tables to match. With "zero-cost" 
>> exceptions, the unwinder cannot process a frame without its unwind tables.)
> 
> Hand-written assembly? Really?

Yep. The forwarding machinery needs to pull parameters off the stack for 
arbitrary method signatures. You can't do that in C.


-- 
Greg Parker gpar...@apple.com Runtime Wrangler


___

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

Please do not post 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: Exception not being caught

2011-03-21 Thread Steve Steinitz

Hi Johnathan

On 21/03/11, Rick Mann & Jonathan Mitchell wrote:


My NSOperation subclass wraps the call to the network code in a
@try/catch block. But when this exception is raised, the app
terminates due to an uncaught exception.



Exceptions on the main thread of a Cocoa application do not typically
rise to the level of the uncaught exception handler because the global
application object catches all such exceptions.

This might indicate that your exception is not occurring on your main thread.

Check out the section entitled "Controlling a Program's Response to Exceptions".


That is an interesting reference, but the behavior I see doesn't 
seem to exactly fit a threading hypothesis.


I've set up an uncaught exception handler delegate (a subclass 
of NSExceptionHandlerDelegate).  When Apple's code throws 
exceptions from, say,


+[NSObject(NSObject) doesNotRecognizeSelector:]
+[NSObject(NSObject) doesNotRecognizeSelector:]
___forwarding___
_CF_forwarding_prep_0

(probably not a separate thread)

or Core Data's

_PFFaultHandlerLookupRow
-[NSFaultHandler fulfillFault:withContext:]
_PF_FulfillDeferredFault
-[NSManagedObject valueForKey:]
-[NSFunctionExpression expressionValueWithObject:context:]
-[NSComparisonPredicate evaluateWithObject:substitutionVariables:]
_filterObjectsUsingPredicate
-[NSArray(NSPredicateSupport) filteredArrayUsingPredicate:]

(maybe a separate thread?)

my local @catch blocks are not invoked - instead, my 
NSExceptionHandlerDelegate subclass catches them.


The former is easy enough to simulate for testing but the latter 
needs a real error (doesn't it?).  My latest stab-in-the-dark 
try is to put one or two of the following at the end of 
troublesome @try blocks:


[[NSRunLoop mainRunLoop] runUntilDate:[NSDate distantPast]];

I've used those elsewhere (e.g. waiting for NSArrayController 
newObject to do its thing - don't ask :) and have noticed that 
they can throw @catch-able exceptions from the Apple frameworks.


That nastiness failing, it would be handy to have a bullet-proof 
way to @catch any exception originating from a @try block - 
non-main thread, alternate universe or otherwise.


Cheers,

Steve Steinitz

___

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

Please do not post 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: Popover Shrinks beyond Indicator

2011-03-21 Thread Gordon Apple
Because this is a public forum, I assumed it would be clear I was referring
to iOS.  I know nothing about Lion.  Haven¹t even downloaded it.

On 3/21/11 3:59 PM, "Corbin Dunn"  wrote:

> Hi Gordon,
> 
> On Mar 21, 2011, at 12:34 PM, Gordon Apple wrote:
> 
>> > I have a popover with a navigation controller, which launches from a button
>> > near the right side of (and at toe top of) the screen.  Subsequent smaller
>> > panels within the popover downsize correctly, but resizing is always by
>> > moving in the right side of the popover, often beyond the anchor point for
>> > the popover, in which case the indicator arrow no longer points to the
>> > anchor point because the popover is then too narrow.  Is there any way to
>> > fix this?
>> > 
> 
> Popovers are a Lion feature which can not be discussed here on the public
> mailing list. Please post questions on popovers to the preview developer forum
> page.
> 
> You could be talking about UIPopover, but your post was non-specific.
> 
> --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: HTML Writer class

2011-03-21 Thread Philip Vallone

Thanks Mike!

On Mar 21, 2011, at 10:45 AM, Mike Abdullah wrote:

> https://github.com/karelia/KSHTMLWriter
> Standard BSD license

___

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

Please do not post 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 4 developer agreement?

2011-03-21 Thread Rick Mann
Where is this document to be found? I've looked all over the iOS developer 
portal (and iTunesConnect), and can't find it.

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


UISegmentedControl -selectSegmentAtIndex:?

2011-03-21 Thread Jon Sigman
iOS 4.3. I'm using a UISegmentedControl and want to preselect one of the 
segments in -viewDidLoad based on the last user setting stored in defaults. 
But, 
I can't find a -selectSegmentAtIndex: method or a reasonable facsimile. How can 
I go about doing this?



  
___

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

Please do not post 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: UISegmentedControl -selectSegmentAtIndex:?

2011-03-21 Thread Luke the Hiesterman
@property(nonatomic) NSInteger selectedSegmentIndex;

so, segmentedControl.selectedSegmentIndex = theIndexYouWant;

Luke

On Mar 21, 2011, at 6:49 PM, Jon Sigman wrote:

> iOS 4.3. I'm using a UISegmentedControl and want to preselect one of the 
> segments in -viewDidLoad based on the last user setting stored in defaults. 
> But, 
> I can't find a -selectSegmentAtIndex: method or a reasonable facsimile. How 
> can 
> I go about doing this?
> 
> 
> 
> 
> ___
> 
> Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)
> 
> Please do not post 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: UISegmentedControl -selectSegmentAtIndex:?

2011-03-21 Thread Jon Sigman
Thanks, Luke. Somehow I was thinking that was a read-only property ("selected" 
= 
past tense). My bad.





From: Luke the Hiesterman 
To: Jon Sigman 
Cc: cocoa-dev@lists.apple.com
Sent: Mon, March 21, 2011 6:53:58 PM
Subject: Re: UISegmentedControl -selectSegmentAtIndex:?

@property(nonatomic) NSInteger selectedSegmentIndex;

so, segmentedControl.selectedSegmentIndex = theIndexYouWant;

Luke

On Mar 21, 2011, at 6:49 PM, Jon Sigman wrote:

> iOS 4.3. I'm using a UISegmentedControl and want to preselect one of the 
> segments in -viewDidLoad based on the last user setting stored in defaults. 
>But, 
>
> I can't find a -selectSegmentAtIndex: method or a reasonable facsimile. How 
> can 
>
> I go about doing this?
> 
> 
> 
> 
> ___
> 
> Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)
> 
> Please do not post 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


Error reporting in Cocoa (was Re: Exception not being caught)

2011-03-21 Thread Chris Hanson
On Mar 21, 2011, at 2:19 PM, Rick Mann wrote:

>> You can't currently throw an exception across a forwarded call. When the 
>> exception unwinder hits the forwarding frame, it stops and the exception 
>> goes uncaught. You'll need to put your exception handler at a different 
>> level.
> 
> Hrm. This is actually a bit of a pickle. HessianKit implements the Hessian 
> RPC API. It does so by having the client declare a protocol (and a mapping 
> from Obj-C-to-Java method signatures), and the providing an implementation 
> for the selector. In this case, my code is actually calling a selector that 
> results in an invocation of a method on my server.
> 
> There really is no place for me to put an exception handler. I could modify 
> HessianKit, and trap exceptions in the forwarding code, but there's no way to 
> report the error back to my calling code.

That’s a bit of an issue anyway, for which it would probably be worth modifying 
HessianKit:  Regardless of one’s feelings on the topic, exceptions are not an 
appropriate mechanism for handling either control flow or error reporting in 
Cocoa or Cocoa Touch code.

The reason is that if your exception crosses any stack frame you don’t fully 
control, all bets are off when it comes to the state of your program.  The 
frameworks have all been written with the assumption that exceptions are only 
for catastrophic (non-recoverable) failures, and that the only way to respond 
to an exception is to terminate the application as gracefully as possible.

When writing code to interoperate with Cocoa and Cocoa Touch, everyone needs to 
follow the same pattern; this is an area where (as you’ve found) impedance 
mismatch will cause problems.

Ultimately, the solution will be to modify HessianKit -- or any other framework 
that presents an RPC-style interface[1] -- to follow the Cocoa convention of 
returning BOOL (or a non-nil/nil object reference) to indicate success or 
failure, and to fill in an NSError passed by reference if the caller desires 
additional failure details.

  -- Chris

[1] Distributed Objects doesn’t work this way - it predates NSError and uses 
exceptions, which results in exactly the problems discussed in this thread.  
Often DO calls will wind up wrapped in an API that just does a @try/@catch 
around the call and returns success/failure, for exactly this reason.

___

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

Please do not post 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: Error reporting in Cocoa (was Re: Exception not being caught)

2011-03-21 Thread Rick Mann

On Mar 21, 2011, at 7:24 PM, Chris Hanson wrote:

> The reason is that if your exception crosses any stack frame you don’t fully 
> control, all bets are off when it comes to the state of your program.  The 
> frameworks have all been written with the assumption that exceptions are only 
> for catastrophic (non-recoverable) failures, and that the only way to respond 
> to an exception is to terminate the application as gracefully as possible.

Not sure I agree that this is a good reason. Prior to Mac OS X, I wrote a lot 
of Carbon code with callbacks in C++. I understood the need to install a top 
(callback)-level exception handler to ensure the exceptions weren't propagated 
back into unaware code. I did this frequently and successfully.

Cocoa's approach effectively forbids exceptions as a convenient and elegant 
exceptional-condition-handling mechanism, yet the occasional use within Cocoa 
itself means I still have to deal with the consequences.

Moreover, since exceptions did work across forward invocations prior to Cocoa 
Touch and 64-bit Mac OS X, I think it is reasonable to assume they should still 
work.

In the meantime, I've modified HessianKit to catch exceptions and return them 
as a return parameter, and all my instances of calling RPC methods now check 
their return parameter to see if it's an exception.

What I had before was better: not only could I catch exceptions in HessianKit 
(like network errors), I was also able to catch exceptions thrown in the Java 
server. It was pretty cool.

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


NSArrayController selected objects mystery

2011-03-21 Thread Larry Campbell
I am baffled. An NSArrayController I'm using occasionally gets into a state 
where selectionIndexes returns an NSIndex with one index, 0, which is what I 
expect and desire, but selectionIndex returns NSNotFound and selectedObjects 
returns an empty array. How can this be?

- lc

___

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

Please do not post 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


Adding tabs programaticaly?

2011-03-21 Thread Vyacheslav Karamov

Hi All!

I'm writing IB 3.2 plug-in for NSTabView descendant.

After adding new tab

CLTabViewItem * item = [[CLTabViewItem alloc] init];
[item setLabel: @"new Item"];
[tabView addTabViewItem: item];

I'm trying to select it and edit is properties. But IB crashes with 
error messages.


2011-03-21 15:44:35.899 Interface Builder[2398:a0f] Message: 
ibObjectAtLocation: asked to object not in the document
2011-03-21 15:45:23.413 Interface Builder[2398:a0f] Assertion Failure: 
[[controller document] containsObject:self]
2011-03-21 15:45:23.414 Interface Builder[2398:a0f] File: 
/SourceCache/InterfaceBuilder/InterfaceBuilder-851/Framework/PublicCategories/IBObjectIntegration.m

2011-03-21 15:45:23.414 Interface Builder[2398:a0f] Line: 213
2011-03-21 15:45:23.430 Interface Builder[2398:a0f] Backtrace:
0   InterfaceBuilderKit  0x0011f909 
-[NSView(IBViewIntegration) ibObjectAtLocation:inWindowController:] + 1017
1   CocoaPlugin  0x1283b758 
IBShouldSubstituteSwapperForObjectInContextOfArchiver + 48132
2   InterfaceBuilderKit  0x0011f848 
-[NSView(IBViewIntegration) ibObjectAtLocation:inWindowController:] + 824
3   InterfaceBuilderKit  0x0011e00d 
-[NSObject(IBFrameworkObjectIntegration) 
ibObjectAtLocation:inWindowController:] + 708
4   InterfaceBuilderKit  0x001b2867 
-[IBViewEditorWindowController objectAtPoint:] + 79
5   InterfaceBuilderKit  0x00122c07 
-[IBViewEditorWindowController trackMeasurementsWithEvent:atPoint:] + 58
6   InterfaceBuilderKit  0x0011629c 
-[IBViewEditorWindowController interceptEvent:] + 289
7   InterfaceBuilderKit  0x00116140 -[IBEditableWindow 
sendEvent:] + 70
8   AppKit   0x91a2352b -[NSApplication 
sendEvent:] + 5683

9   Interface Builder0x4615
10  AppKit   0x919b72a7 -[NSApplication run] + 917
11  AppKit   0x919af2d9 NSApplicationMain + 574
12  Interface Builder0x22c5
13  Interface Builder0x0003

What I did wrong?
___

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

Please do not post 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


NSTableColumn dataCellForRow:

2011-03-21 Thread William Weygandt

Hi,
I know this has been discussed before, but I just don't get it:

I need to set attributes for a TableColumn cell, based on its row, 
leaving the cells of other rows, unchanged.  I tried using the method 
dataCellForRow:.  I just can't seem to make this work.  Not sure I can subclass 
this because the delegate will reference this method.

Any ideas?

Also, what documents discuss this?  I haven't found a good explanation 
in the otherwise comprehensive Apple docs.
Thank you in advance,
Bill___

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

Please do not post 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: MPMoviePlayerController setContentURL twice

2011-03-21 Thread Matt Neuburg
On Mon, 21 Mar 2011 16:04:52 -0500, Heath Borders  
said:
>I create an embedded MPMoviePlayerController thusly inside my loadView method:
>
>self.moviePlayerController = [[[MPMoviePlayerController alloc] init]
>autorelease];
>
>// add to view, setup moviePlayerController's view frame, etc
>
>And I can later load a movie the user chooses thusly:
>
>NSURL *fileUrl = ...
>self.moviePlayerController.contentURL = fileUrl;
>
>and everything works great.
>
>
>However, if I set the contentURL again:
>
>NSURL *fileUrl2 = ...
>self.moviePlayerController.contentURL = fileUrl2;
>
>This does not work, even if fileUrl2 == fileUrl1.
>
>When I change the contentURL, I get the following playbackState and loadState:
>
>After first setContentURL:
>loadState == playable | playthroughOK
>playbackState == playing
>
>After my second setContentURL:
>playbackState == stopped
>loadState == unknown
>
>I can of course create a new MPMoviePlayerController for every movie,
>but I want to make sure this issue isn't indicative of a larger
>problem.

You shouldn't have to create a new MPMoviePlayerController. Setting the 
contentURL to a different URL works fine. Something else must be going on at 
your end. As always, my advice is: make a new project, reduce this to the 
absolute simplest possible case (an MPMoviePlayerController, its view, two 
embedded movies, and two buttons) and convince yourself. m.

--
matt neuburg, phd = m...@tidbits.com, 
A fool + a tool + an autorelease pool = cool!
Programming iOS 4!
http://www.apeth.net/matt/default.html#iosbook___

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

Please do not post 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: MPMoviePlayerController setContentURL twice

2011-03-21 Thread Heath Borders
That's exactly what I did.  I have a brand new project with just a
ViewController with 3 views: 1 to hold the MPMoviePlayerController's
view, 1 button for my first movie, and 1 button for my second movie.
When the buttons are clicked, I create NSURLs from the appropriate
files.  I've included my controller.  I just set it as the window's
rootViewController in my appDelegate.  Any comments you have are
greatly appreciated!

#import 
#import 
#import 
#import 


@interface MoviePlayerViewController : UIViewController {

}

@end

@interface MoviePlayerViewController()

@property (nonatomic, retain) UIView *moviePlayerHolderView;
@property (nonatomic, retain) MPMoviePlayerController *moviePlayerController;

- (void)loadBigVideoFromFile;
- (void)loadBigAudioFromFile;
- (void)loadAssetFromFileUrl: (NSURL *) fileUrl;

- (void)moviePlayerLoadStateDidChange;
- (void)moviePlayerPlaybackStateDidChange;

@end

@implementation MoviePlayerViewController

@synthesize moviePlayerHolderView = _moviePlayerHolderView;
@synthesize moviePlayerController = _moviePlayerController;

#pragma mark -
#pragma mark init/dealloc methods

- (id)init {
self = [super initWithNibName:nil bundle:nil];
if (self) {

}
return self;
}

- (void)dealloc {
self.moviePlayerHolderView = nil;
self.moviePlayerController = nil;

[[NSNotificationCenter defaultCenter] removeObserver:self];

[super dealloc];
}

#pragma mark -
#pragma mark UIViewController

- (void)loadView {
[super loadView];

self.moviePlayerHolderView = [[[UIView alloc]
initWithFrame:CGRectMake(CGRectGetMinX(self.view.bounds),

   
CGRectGetMinY(self.view.bounds),

   
CGRectGetWidth(self.view.bounds),

   
CGRectGetHeight(self.view.bounds) - 50)] autorelease];
self.moviePlayerHolderView.autoresizingMask =
UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleHeight;

[self.view addSubview:self.moviePlayerHolderView];

self.moviePlayerController = [[[MPMoviePlayerController alloc] init]
autorelease];
[[NSNotificationCenter defaultCenter] addObserver:self

 selector:@selector(moviePlayerLoadStateDidChange)

 name:@"MPMoviePlayerLoadStateDidChangeNotification"

   object:self.moviePlayerController];
[[NSNotificationCenter defaultCenter] addObserver:self

 selector:@selector(moviePlayerPlaybackStateDidChange)

 name:@"MPMoviePlayerPlaybackStateDidChangeNotification"

   object:self.moviePlayerController];
self.moviePlayerController.controlStyle = MPMovieControlStyleEmbedded;
self.moviePlayerController.movieSourceType = MPMovieSourceTypeFile;
self.moviePlayerController.shouldAutoplay = NO;
self.moviePlayerController.view.autoresizingMask =
UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleHeight;
self.moviePlayerController.view.frame = 
self.moviePlayerHolderView.bounds;

[self.moviePlayerHolderView addSubview:self.moviePlayerController.view];

UIButton *loadAudioButton = [UIButton 
buttonWithType:UIButtonTypeRoundedRect];
loadAudioButton.autoresizingMask =
UIViewAutoresizingFlexibleRightMargin |
UIViewAutoresizingFlexibleTopMargin;
loadAudioButton.frame = CGRectMake(CGRectGetMinX(self.view.bounds),
   
CGRectGetMaxY(self.moviePlayerHolderView.frame),
   
CGRectGetWidth(self.view.bounds) / 2,
   50);
[loadAudioButton addTarget:self

action:@selector(loadBigAudioFromFile)
  forControlEvents:UIControlEventTouchUpInside];
[loadAudioButton setTitle:@"Load Audio"
 forState:UIControlStateNormal];

[self.view addSubview:loadAudioButton];
  

Re: UIWebView HTML to match UITextView

2011-03-21 Thread Matt Neuburg
On Mon, 21 Mar 2011 20:58:40 +1100, BareFeetWare 
 said:
>Hi all,
>
>I'm trying to show text in a UIWebView to match exactly how it appears in a 
>UITextView. Is there a standard library or subclass to do this?
>

This might not be possible, as they may use two completely different engines 
for drawing. m.

--
matt neuburg, phd = m...@tidbits.com, 
A fool + a tool + an autorelease pool = cool!
Programming iOS 4!
http://www.apeth.net/matt/default.html#iosbook___

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

Please do not post 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: Adding tabs programaticaly?

2011-03-21 Thread Seth Willits
On Mar 21, 2011, at 7:08 AM, Vyacheslav Karamov wrote:

> I'm writing IB 3.2 plug-in

One might wonder why given that they're deprecated thanks to Xcode 4...


--
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: NSTableColumn dataCellForRow:

2011-03-21 Thread Quincey Morris
On Mar 21, 2011, at 16:16, William Weygandt wrote:

>   I need to set attributes for a TableColumn cell, based on its row, 
> leaving the cells of other rows, unchanged.  I tried using the method 
> dataCellForRow:.  I just can't seem to make this work.  Not sure I can 
> subclass this because the delegate will reference this method.

Can you ask a more specific question. We've no idea what you've tried and 
what's failed. We don't know what you mean by "can't seem to make this work". 
You might want to post some failing code, if you're not sure how to describe 
the problem. Meantime ...

You shouldn't think in terms of subclassing NSTableColumn -- it just makes it 
too hard to set things up in IB.

Instead you should use one or both of the delegate methods 
'tableView:dataCellForTableColumn:row:' and 
'tableView:willDisplayCell:forTableColumn:row:' (or the parallel variants used 
by outline views). All you have to do is the keep them straight in your mind.

'tableView:dataCellForTableColumn:row:' is called to obtain a cell to use at a 
specific row/column position, in case you want to use a different kind of cell 
(or for some reason just a different cell) from the default provided by the 
column. At the time this is called, the cell is not being configured yet, just 
being obtained, so anything you do to it is subject to being undone by 
NSTableView.

'tableView:willDisplayCell:forTableColumn:row:' is called sometime after that 
to configure a cell for use, whether the cell was provided by your 
'tableView:dataCellForTableColumn:row:' or not. (The "not" case happens when 
you don't implement that delegate method, or it returns nil.)  When this second 
method is called, the cell has already been configured as far as the table view 
knows how (e.g. it's set the correct object value), so you can make any further 
adjustments you need.

So, if your table column has a text field cell, you would use the first 
delegate method (for example) to change to an image cell in certain rows. Or, 
if a text field cell has been chosen for the row/column, you would use the 
second delegate method (for example) to change the color of the text. Or, if 
you needed to change to an image cell for some rows *and* configure the image 
being displayed, you'd do that in two steps, using one delegate method for each.

Does that help at all?


___

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

Please do not post 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 migration opens ~ file by mistake

2011-03-21 Thread Michael Link
I'm running into this same problem on 10.6 when the migration is automatic or 
manual. I can always reproduce it with manual migration.

After migration and the document window is open and the application is made 
inactive and active again you may notice the title of the document has suddenly 
changed to the backup file with the ~ before the extension. It appears that the 
magic file watching behavior of NSDocument decides to switch back to the backup 
file which typically causes unexpected behavior.

#0  0x12fb9 in -[MyDocument setFileURL:] at MyDocument.m:556
#1  0x7fff80b0fdcc in -[NSDocument _handleDocumentFileChanges:]
#2  0x7fff887c67b4 in -[NSArray makeObjectsPerformSelector:withObject:]
#3  0x7fff8329523c in __NSFireDelayedPerform
#4  0x7fff887b1be8 in __CFRunLoopRun
#5  0x7fff887afdbf in CFRunLoopRunSpecific
#6  0x7fff854cc93a in RunCurrentEventLoopInMode
#7  0x7fff854cc69d in ReceiveNextEventCommon
#8  0x7fff854cc5f8 in BlockUntilNextEventMatchingListInMode
#9  0x7fff80939e64 in _DPSNextEvent
#10 0x7fff809397a9 in -[NSApplication 
nextEventMatchingMask:untilDate:inMode:dequeue:]
#11 0x7fff808ff48b in -[NSApplication run]
#12 0x7fff808f81a8 in NSApplicationMain
#13 0x1e7f5 in main at main.m:27

I've fixed this in my manual migration by using FSExchangeObjects(). 
Unfortunately the docs say that it only works on HFS+ and AppleShares... and 
perhaps you don't like to make assumptions about where people store their data.

I've also fixed this by using NSFileManager's 
-replaceItemAtURL:withItemAtURL:backupItemName:options:resultingItemURL:error:

This appears to work if you don't use the 
NSFileManagerItemReplacementWithoutDeletingBackupItem option. If you do then 
you will need to know where the backup file is located and add this method to 
your NSDocument subclass.

- (void)setFileURL:(NSURL*)absoluteURL
{
if ([absoluteURL isEqual:_backupURL]) {
[super setFileURL:[self fileURL]];
return;
}

[super setFileURL:absoluteURL];
}

--
Michael

On Feb 22, 2011, at 10:36 PM, Jim Thomason wrote:

> I'm finally trying to do my first CoreData migration using the "new"
> style 10.5 built-in migration tools. I'd abandoned my ad-hoc Tiger one
> a while back and finally needed to migrate.
> 
> I'm building on Snow Leopard, and bugs and glitches aside (such as the
> workaround for migration for Leopard deployment built on Snow
> Leopard), it's mostly working. But what it boils down to is when I
> deploy it on Leopard, the migration is correctly performed, but then
> the app insists upon re-opening the foo~.ext file (the backup with the
> tilde) instead of the actual upgraded data file itself. The simple
> solution is just to shut the doc w/o saving, then re-open it. All
> problems solved when I do that, but I don't really want to ask my
> users to do it.
> 
> It behaves just fine on Snow Leopard.
> 
> I found some old posts referencing the issue, such as:
> http://lists.apple.com/archives/cocoa-dev/2009/Nov/msg01431.html
> 
> But no functional solutions. I tried implementing mmalc's custom
> NSDocumentController subclass, but the issue persisted. So I dropped
> it out and left just the standard modification to
> configurePersistentStoreCoordinatorForURL: to turn on
> forKey:NSMigratePersistentStoresAutomaticallyOption.
> 
> Sometimes the ~ pops up in the title bar, sometimes it doesn't. The
> doc is never actually save-able.
> 
> Did anyone ever discover a viable solution?
> 
> -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/mlink%40fractal.net
> 
> This email sent to ml...@fractal.net
> 
> 

___

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

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

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

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


Re: Adding tabs programaticaly?

2011-03-21 Thread Kyle Sluder
On Mon, Mar 21, 2011 at 9:04 PM, Seth Willits  wrote:
> On Mar 21, 2011, at 7:08 AM, Vyacheslav Karamov wrote:
>
>> I'm writing IB 3.2 plug-in
>
> One might wonder why given that they're deprecated thanks to Xcode 4...

Please file a bug against Xcode 4 telling the dev team that you're
using this functionality. The rest of us who were struck by this
deprecation would appreciate others speaking up too.

--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: UIWebView HTML to match UITextView

2011-03-21 Thread BareFeetWare
> On Mon, 21 Mar 2011 20:58:40 +1100, BareFeetWare 
>  said:
>> 

>> I'm trying to show text in a UIWebView to match exactly how it appears in a 
>> UITextView. Is there a standard library or subclass to do this?
>> 

On 22/03/2011, at 2:59 PM, Matt Neuburg wrote:
> 
> This might not be possible, as they may use two completely different engines 
> for drawing. m.

Thanks for your reply.

Well, the odd thing is that UITextView and UIWebView seem to very closely mimic 
each other. Neither of them match the layout resulting from using CoreText. I 
wrote some CoreText code to layout my text, some time back, and it uses very 
different spacing. WebKit and UITextView seem identical, down to the pixel, in 
layout, with only a few small exceptions, like the ones I mentioned earlier.

I have my own class and methods for converting text to HTML (including 
converting < to < etc), but I thought since this must be a common 
requirement, that there is some more robust class out there.

My particular need arises because of multicoloured text. My method actually 
takes an NSAttributedString and converts all the color changes into CSS/HTML 
etc.

Anyone out there converting text to HTML with the same layout as UITextView?

Thanks,
Tom
BareFeetWare
___

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

Please do not post 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: MPMoviePlayerController setContentURL twice

2011-03-21 Thread Matt Neuburg
On Mon, 21 Mar 2011 22:59:04 -0500, Heath Borders  
said:
>That's exactly what I did.  I have a brand new project with just a
>ViewController with 3 views
>
>[SNIP ridiculous quantities of code]

I can't read that. And it isn't what I suggested you do. I said make a 
*minimal* project. Enough to prove to yourself that setting the contentURL 
works. And no more than that! Here's my code; this is what I mean when I say 
"minimal" and "simple" and stuff like that:

- (void)viewDidLoad {
[super viewDidLoad];
MPMoviePlayerController *player = [[MPMoviePlayerController alloc] init];
player.shouldAutoplay = NO;
player.controlStyle = MPMovieControlStyleNone;
[player.view setFrame: CGRectMake(0,0,200,150)];
[self.view addSubview: player.view];
self.thePlayer = player;
[player release];

}
- (IBAction)play1:(id)sender { // button 1
[self.thePlayer setContentURL: [[NSBundle mainBundle] 
URLForResource:@"blend1" withExtension:@"mp4"]];
[self.thePlayer play];
}

- (IBAction)play2:(id)sender { // button 2
[self.thePlayer setContentURL: [[NSBundle mainBundle] 
 URLForResource:@"xbox" withExtension:@"mp4"]];
[self.thePlayer play];
}

That's all. It works. So then you build up from there towards what you *really* 
want to do. When it stops working, that's when you broke it. m.


--
matt neuburg, phd = m...@tidbits.com, 
A fool + a tool + an autorelease pool = cool!
Programming iOS 4!
http://www.apeth.net/matt/default.html#iosbook___

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

Please do not post 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: iOS 4 developer agreement?

2011-03-21 Thread Jeffrey Walton
On Mon, Mar 21, 2011 at 9:26 PM, Rick Mann  wrote:
> Where is this document to be found? I've looked all over the iOS developer 
> portal (and iTunesConnect), and can't find it.
>
Visit developer.apple.com. Log into the Member Center. Near the upper
left, click the link on your Organization. Once your Organization is
displayed, you will have access to Legal Agreements.

Jeff
___

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

Please do not post 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: iOS 4 developer agreement?

2011-03-21 Thread Rick Mann
Thanks much!

On Mar 21, 2011, at 10:44 PM, Jeffrey Walton wrote:

> On Mon, Mar 21, 2011 at 9:26 PM, Rick Mann  wrote:
>> Where is this document to be found? I've looked all over the iOS developer 
>> portal (and iTunesConnect), and can't find it.
>> 
> Visit developer.apple.com. Log into the Member Center. Near the upper
> left, click the link on your Organization. Once your Organization is
> displayed, you will have access to Legal Agreements.
> 
> Jeff

___

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

Please do not post 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