Re: NSBox line with autolayout

2014-04-11 Thread Julian
I just resolved it by checking 'Autoresizes Subviews' on the NSBox itself
in the nib. For some reason, that triggers the behavior I'm looking for in
my situation. I'm not sure why it's not needed in other circumstances,
though.


On Fri, Apr 11, 2014 at 2:45 PM, Julian  wrote:

> Hmm yes. Doing some sanity checks is a good idea I guess. My next thought
> was that maybe I don't know how to set it up properly when nested inside a
> scroll view. But I just created a test project for that scenario and got it
> to work.
>
> The last interesting thing I am doing is that the NSBox is inside a view
> isolated in its own nib file which is loaded and added to another view. I
> am dynamically adding constraints that should specify the width resizing
> like this:
>
> constraint = [NSLayoutConstraint constraintWithItem:flavorView
> attribute:NSLayoutAttributeLeft relatedBy:NSLayoutRelationEqual
> toItem:flavorContainerView attribute:NSLayoutAttributeLeft multiplier:1.0
> constant:0];
> [flavorContainerView addConstraint:constraint];
>
> constraint = [NSLayoutConstraint constraintWithItem:flavorView
> attribute:NSLayoutAttributeRight relatedBy:NSLayoutRelationEqual
> toItem:flavorContainerView attribute:NSLayoutAttributeRight multiplier:1.0
> constant:0];
> [flavorContainerView addConstraint:constraint];
>
> The NSBox is contained inside flavorView.
>
>
> On Fri, Apr 11, 2014 at 2:38 AM, Jonathan Mitchell 
> wrote:
>
>>
>> On 10 Apr 2014, at 22:30, Julian  wrote:
>>
>> > After converting my NIB to use autolayout, I'm not getting an NSBox to
>> > redraw itself at the correct width.
>> >
>> > I have a 'Horizontal Line' (NSBox). In the old model, the autoresizing
>> mask
>> > indicated flexible width. To replace it with constraints, I used:
>> leading
>> > space to superview = 0, top space to superview = 0, width = superview
>> > width.
>> >
>> > This unfortunately does not get the line to be redrawn to the
>> appropriate
>> > width. Other views with similar constraints are getting wider. ( I also
>> > tried trailing space to superview = 0.)
>> >
>> I tried this with an NSBox and it worked fine.
>>
>> Make sure that the Translates Masks into Constraints checkbox is off for
>> the NSBox's top level view.
>>
>> Jonathan
>> ___
>>
>> Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)
>>
>> Please do not post admin requests or moderator comments to the list.
>> Contact the moderators at cocoa-dev-admins(at)lists.apple.com
>>
>> Help/Unsubscribe/Update your Subscription:
>> https://lists.apple.com/mailman/options/cocoa-dev/jpellico%40gmail.com
>>
>> This email sent to jpell...@gmail.com
>
>
>
___

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

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

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

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

Re: Exception going "uncaught" despite active @catch handler

2014-04-11 Thread Jens Alfke

On Apr 11, 2014, at 2:26 PM, Greg Parker  wrote:

> libdispatch has its own catch-and-halt exception handler here. It does not 
> allow exceptions to be thrown across its boundaries. The GCD reference says 
> "Your application must catch all exceptions before returning from a block 
> submitted to a dispatch queue."

Makes sense, since that boundary is the moral equivalent of a different thread. 
I’m more used to using perform-after-delay to schedule calls, and CFRunLoop is 
more forgiving about exceptions, so this didn’t occur to me till after I’d 
posted.

> You may be able to use std::set_terminate() to install a handler that records 
> the test progress so your test machinery can start a new test process where 
> it left off.

The method that does the dispatch_async calls is in a pretty central place in 
my code, so I put an @catch block in it to consume the exception before it gets 
back to GCD. The @catch block also has a hook to my test framework to notify it 
that the exception occurred, so even though RunTest never sees the exception 
itself, it knows the test has failed and reports it as such.

—Jens
___

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

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

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

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

Re: NSBox line with autolayout

2014-04-11 Thread Julian
Hmm yes. Doing some sanity checks is a good idea I guess. My next thought
was that maybe I don't know how to set it up properly when nested inside a
scroll view. But I just created a test project for that scenario and got it
to work.

The last interesting thing I am doing is that the NSBox is inside a view
isolated in its own nib file which is loaded and added to another view. I
am dynamically adding constraints that should specify the width resizing
like this:

constraint = [NSLayoutConstraint constraintWithItem:flavorView
attribute:NSLayoutAttributeLeft relatedBy:NSLayoutRelationEqual
toItem:flavorContainerView attribute:NSLayoutAttributeLeft multiplier:1.0
constant:0];
[flavorContainerView addConstraint:constraint];

constraint = [NSLayoutConstraint constraintWithItem:flavorView
attribute:NSLayoutAttributeRight relatedBy:NSLayoutRelationEqual
toItem:flavorContainerView attribute:NSLayoutAttributeRight multiplier:1.0
constant:0];
[flavorContainerView addConstraint:constraint];

The NSBox is contained inside flavorView.


On Fri, Apr 11, 2014 at 2:38 AM, Jonathan Mitchell wrote:

>
> On 10 Apr 2014, at 22:30, Julian  wrote:
>
> > After converting my NIB to use autolayout, I'm not getting an NSBox to
> > redraw itself at the correct width.
> >
> > I have a 'Horizontal Line' (NSBox). In the old model, the autoresizing
> mask
> > indicated flexible width. To replace it with constraints, I used: leading
> > space to superview = 0, top space to superview = 0, width = superview
> > width.
> >
> > This unfortunately does not get the line to be redrawn to the appropriate
> > width. Other views with similar constraints are getting wider. ( I also
> > tried trailing space to superview = 0.)
> >
> I tried this with an NSBox and it worked fine.
>
> Make sure that the Translates Masks into Constraints checkbox is off for
> the NSBox's top level view.
>
> Jonathan
> ___
>
> Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)
>
> Please do not post admin requests or moderator comments to the list.
> Contact the moderators at cocoa-dev-admins(at)lists.apple.com
>
> Help/Unsubscribe/Update your Subscription:
> https://lists.apple.com/mailman/options/cocoa-dev/jpellico%40gmail.com
>
> This email sent to jpell...@gmail.com
___

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

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

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

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

Re: Exception going "uncaught" despite active @catch handler

2014-04-11 Thread Ken Thomases
On Apr 11, 2014, at 4:12 PM, Jens Alfke wrote:

> I know the Obj-C religion is that exceptions “normally shouldn’t be caught”, 
> but this isn’t exactly a normal situation, it’s unit testing.

It's not a religion and it's not "shouldn't", it's "if an exception has crossed 
through code other than your own, it has probably left it in a corrupt state".  
In the case of GCD, you almost certainly couldn't proceed even if GCD let you, 
because GCD's internal data structures would be messed up.  Locks would be 
permanently locked or they may even stop providing any locking behavior while 
appearing to work (they might report success to multiple threads simultaneously 
rather than being mutually exclusive).  Serial queues would think they're busy 
when they're not.  Or they might run multiple jobs concurrently.  Etc.

There's no hope of meaningful unit testing continuing on from that point, so 
termination is about as good as you're going to get.

Regards,
Ken


___

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

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

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

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

Re: Exception going "uncaught" despite active @catch handler

2014-04-11 Thread Greg Parker

On Apr 11, 2014, at 2:12 PM, Jens Alfke  wrote:

> I’ve got a weird situation where an NSAssertion failure is terminating the 
> process with an “uncaught exception” even though there’s an @try block at a 
> lower stack frame ready to catch it. Stack is below. The RunTestCase() 
> function, down at frame 20, is calling the unit-test function inside of a 
> block like @try{ … } @catch(NSException *x) { … } but the catch block is 
> never entered. Instead the process just quits.
> 
> This is screwing up our automated testing, because unit tests after this 
> failing one are never run. Normally the RunTestCase function just logs the 
> exception and marks the test as failed, then continues to the next one. 
> [Note: this is a custom unit test framework, entirely unrelated to OCUnit.]
> 
> After a bit more debugging I’ve caught the _dispatch_client_callout function 
> at frame 12 calling objc_terminate after the assertion fails. I suppose it 
> has its own catch block that responds by killing the process. Is there any 
> way around this? I know the Obj-C religion is that exceptions “normally 
> shouldn’t be caught”, but this isn’t exactly a normal situation, it’s unit 
> testing.

libdispatch has its own catch-and-halt exception handler here. It does not 
allow exceptions to be thrown across its boundaries. The GCD reference says 
"Your application must catch all exceptions before returning from a block 
submitted to a dispatch queue."

You may be able to use std::set_terminate() to install a handler that records 
the test progress so your test machinery can start a new test process where it 
left off.


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

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

Exception going "uncaught" despite active @catch handler

2014-04-11 Thread Jens Alfke
I’ve got a weird situation where an NSAssertion failure is terminating the 
process with an “uncaught exception” even though there’s an @try block at a 
lower stack frame ready to catch it. Stack is below. The RunTestCase() 
function, down at frame 20, is calling the unit-test function inside of a block 
like @try{ … } @catch(NSException *x) { … } but the catch block is never 
entered. Instead the process just quits.

This is screwing up our automated testing, because unit tests after this 
failing one are never run. Normally the RunTestCase function just logs the 
exception and marks the test as failed, then continues to the next one. [Note: 
this is a custom unit test framework, entirely unrelated to OCUnit.]

After a bit more debugging I’ve caught the _dispatch_client_callout function at 
frame 12 calling objc_terminate after the assertion fails. I suppose it has its 
own catch block that responds by killing the process. Is there any way around 
this? I know the Obj-C religion is that exceptions “normally shouldn’t be 
caught”, but this isn’t exactly a normal situation, it’s unit testing.

—Jens


2014-04-11 13:58:06.550 Couchbase Lite Demo[61665:303] *** Terminating app due 
to uncaught exception 'NSInternalInconsistencyException', reason: 'Assertion 
failed: BOGUS'
*** First throw call stack:
(
0   CoreFoundation  0x7fff8c48f25c 
__exceptionPreprocess + 172
1   libobjc.A.dylib 0x7fff8e74ae75 
objc_exception_throw + 43
2   CoreFoundation  0x7fff8c48f038 
+[NSException raise:format:arguments:] + 104
3   Foundation  0x7fff8805ce06 
-[NSAssertionHandler handleFailureInFunction:file:lineNumber:description:] + 169
4   CouchbaseLite   0x00010017bdcc 
_AssertFailed + 764
5   CouchbaseLite   0x00010016adbf 
-[CBL_ReplicationObserverHelper replChanged:] + 95
6   CoreFoundation  0x7fff8c45de0c 
__CFNOTIFICATIONCENTER_IS_CALLING_OUT_TO_AN_OBSERVER__ + 12
7   CoreFoundation  0x7fff8c3518dd 
_CFXNotificationPost + 2893
8   Foundation  0x7fff87f677ba 
-[NSNotificationCenter postNotificationName:object:userInfo:] + 68
9   CouchbaseLite   0x0001001365e7 
-[CBLReplication updateStatus:error:processed:ofTotal:] + 887
10  CouchbaseLite   0x0001001374a5 
__35-[CBLReplication bg_updateProgress]_block_invoke + 53
11  libdispatch.dylib   0x7fff8c7151bb 
_dispatch_call_block_and_release + 12
12  libdispatch.dylib   0x7fff8c71228d 
_dispatch_client_callout + 8
13  libdispatch.dylib   0x7fff8c719ef0 
_dispatch_main_queue_callback_4CF + 333
14  CoreFoundation  0x7fff8c3f65a9 
__CFRUNLOOP_IS_SERVICING_THE_MAIN_DISPATCH_QUEUE__ + 9
15  CoreFoundation  0x7fff8c3b17c4 
__CFRunLoopRun + 1636
16  CoreFoundation  0x7fff8c3b0f25 
CFRunLoopRunSpecific + 309
17  Foundation  0x7fff87fcdadc 
-[NSRunLoop(NSRunLoop) runMode:beforeDate:] + 253
18  Foundation  0x7fff8801610b 
-[NSRunLoop(NSRunLoop) runUntilDate:] + 78
19  Couchbase Lite Demo 0x00010001b0ba 
Test_CBLIncrementalStoreCBLIntegration + 4522
20  CouchbaseLite   0x00010017a38f RunTestCase 
+ 223
21  CouchbaseLite   0x00010017ab9e RunTestCases 
+ 318
22  Couchbase Lite Demo 0x00011392 main + 34
23  libdyld.dylib   0x7fff85a015fd start + 1
)
libc++abi.dylib: terminating with uncaught exception of type NSException

___

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

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

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

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

Re: iOS: Cannot connect to iTunes Store

2014-04-11 Thread Markus Spoettl

On 4/11/14, 1:41 AM, Steve Christensen wrote:

I’ve been testing IAP in the sandbox store on a development iPod and just
started getting this error in -paymentQueue:updatedTransactions: with
(transaction.transactionState == SKPaymentTransactionStateFailed):

Error Domain=SKErrorDomain Code=0 "Cannot connect to iTunes Store"
UserInfo=0x1aa5e060 {NSLocalizedDescription=Cannot connect to iTunes Store}

[...]

Does anyone have an idea of what else I should be checking?


I had the same thing for a couple of hours yesterday morning. I then removed all 
incarnations of my app (a lot of different beta builds and an app-store 
downloaded version) from the development machine, restarted the Mac (to make 
absolutely sure storeagent doesn't cache things) and waited for 2 hours.


One of the things solved the issue.

Whenever something unexpected happens, a lot of times I find myself killing 
storeagent and storehelper using the Activity Monitor. That helps sometimes.


Regards
Markus
--
__
Markus Spoettl
___

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

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

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

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

Re: Remove redundant AM/PM when formatting a time range?

2014-04-11 Thread Jens Alfke

On Apr 11, 2014, at 8:41 AM, Ben Kazez  wrote:

> I’m trying to create a compact time range format, like “2am-4pm” or 
> “2-5:30pm”. I am constructing the format string using 
> -dateFormatFromTemplate:options:locale:, omitting the minutes from the 
> template if that component is zero. Is there an internationalization-safe way 
> that I can remove the AM/PM from one of the times if it is redundant? What 
> about the space, if a locale considers that space optional?

Can you do this by making the format strings themselves localizable? For 
instance you might have special format string IDs for use when both times are 
AM or both PM, one for the first time and one for the second. The localizer can 
then decide which of those two format strings should drop the AM/PM indicator.

—Jens
___

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

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

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

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

Re: Excessive open gui graphics files on Mavericks

2014-04-11 Thread Maxthon Chan
The game never saw the light of day actually, and we was on the way 
reimplementing libcramfs in BSD license.

On Apr 11, 2014, at 22:56, Fritz Anderson  wrote:

> (The attribution chain is wrong, because I’m coming to this after the message 
> that raised libcramfs.)
> 
> It’s remarkably hard to get an answer to this, so I may be talking through my 
> hat:
> 
> Does this involve linking libcramfs.a into the binary you distribute? Have 
> you published the source of your app?
> 
>   — F
> 
> 
> On 10 Apr 2014, at 2:16 AM, Michael Watson  wrote:
> 
>> On 9 Apr, 2014, at 0:52, Maxthon Chan  wrote:
>> 
>>> LOL
>>> 
>>> I actually used cramfs once in a game carried the rules database. The rules 
>>> are so complicated so I tried to make it smaller without sacrificing the 
>>> efficiency of the game code. Ended up using cramfs for that.
>>> 
> 
> 
> ___
> 
> Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)
> 
> Please do not post admin requests or moderator comments to the list.
> Contact the moderators at cocoa-dev-admins(at)lists.apple.com
> 
> Help/Unsubscribe/Update your Subscription:
> https://lists.apple.com/mailman/options/cocoa-dev/xcvista%40me.com
> 
> This email sent to xcvi...@me.com



signature.asc
Description: Message signed with OpenPGP using GPGMail
___

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

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

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

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

Remove redundant AM/PM when formatting a time range?

2014-04-11 Thread Ben Kazez
Hello,

I’m trying to create a compact time range format, like “2am-4pm” or “2-5:30pm”. 
I am constructing the format string using 
-dateFormatFromTemplate:options:locale:, omitting the minutes from the template 
if that component is zero. Is there an internationalization-safe way that I can 
remove the AM/PM from one of the times if it is redundant? What about the 
space, if a locale considers that space optional?

Specifically, I’m concerned that (1) in some languages, I might have to remove 
it from the end time, not the start, and (2) the spaces will get in the way of 
removing the redundant AM/PM.

Even if I can only make it work for a few languages (perhaps just by modifying 
the format string returned from -dateFormatFromTemplate?), it seems it would be 
worth it for the human-friendly result.

Ben
___

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

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

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

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

Re: Excessive open gui graphics files on Mavericks

2014-04-11 Thread Fritz Anderson
(The attribution chain is wrong, because I’m coming to this after the message 
that raised libcramfs.)

It’s remarkably hard to get an answer to this, so I may be talking through my 
hat:

Does this involve linking libcramfs.a into the binary you distribute? Have you 
published the source of your app?

— F


On 10 Apr 2014, at 2:16 AM, Michael Watson  wrote:

> On 9 Apr, 2014, at 0:52, Maxthon Chan  wrote:
> 
>> LOL
>> 
>> I actually used cramfs once in a game carried the rules database. The rules 
>> are so complicated so I tried to make it smaller without sacrificing the 
>> efficiency of the game code. Ended up using cramfs for that.
>> 


___

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

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

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

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

Re: NSBox line with autolayout

2014-04-11 Thread Jonathan Mitchell

On 10 Apr 2014, at 22:30, Julian  wrote:

> After converting my NIB to use autolayout, I'm not getting an NSBox to
> redraw itself at the correct width.
> 
> I have a 'Horizontal Line' (NSBox). In the old model, the autoresizing mask
> indicated flexible width. To replace it with constraints, I used: leading
> space to superview = 0, top space to superview = 0, width = superview
> width.
> 
> This unfortunately does not get the line to be redrawn to the appropriate
> width. Other views with similar constraints are getting wider. ( I also
> tried trailing space to superview = 0.)
> 
I tried this with an NSBox and it worked fine.

Make sure that the Translates Masks into Constraints checkbox is off for the 
NSBox’s top level view.

Jonathan
___

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

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

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

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