Re: Unnecessary Boolean Warning

2011-08-04 Thread Sander Stoks
 One important difference for instance is that if you write if (a() 
 b()), both a() and b() will always be executed, while if you write if
 (a()  b()), b() will be executed only if a() is true.


 The C language doesn't make any guarantees about that. While this
 optimisation is to be expected, the order of execution (left to right)
 and the optimisation (b not executed) is implementation dependent.

 This is a classic question for coding job interviews.

As has been pointed out, it most certainly does.  This is important
because it allows you to write stuff like

if (index  maxIndex  isValid(array[index]))
   ...

In languages which don't guarantee short-circuiting, the array could be
indexed out-of-bounds.

On a related note, somebody said he would be less confused if C didn't
have two different kind of booleans.  In fact, it has none at all.  It
is part of the idiom that you should read if(a) as if a is non-zero
and not as if a is true.

Regards,
Sander


___

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

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

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

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


Re: How to Identify if the device is used in iAD supported Regions

2011-08-04 Thread Conrad Shultz
Full disclosure: I don't use iAd, so this is based on WWDC recollection and doc 
lookup. 

The Test Advertisement I believe only displays when you are testing during 
development. Users will never see it.

Keep the banner view hidden until you receive a bannerViewDidLoadAd: message in 
the ad delegate. Presumably this just won't get called in regions that don't 
support iAd.

You could setup a timer to load from other ad networks if you don't receive an 
iAd within some predetermined period. 

(Sent from my iPad.)

--
Conrad Shultz
www.synthetiqsolutions.com

On Aug 3, 2011, at 20:46, Sasikumar JP jps...@gmail.com wrote:

 I am planning to use iAD for my iOS application. As the iAD available
 only in USA,UK,France,Italia,Deutschland,España AppStores.
 
 I want to display iAD only for supported regions. This will avoid
 displaying Test Advertisement from iAD.I can use AdMob for all other
 regions.
 
 I am not sure, how to identify the iOS Device is used in supported region?
 
 Any help is highly appreciated.
 
 Thanks
 
 Sasikumar JP
 ___
 
 Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)
 
 Please do not post admin requests or moderator comments to the list.
 Contact the moderators at cocoa-dev-admins(at)lists.apple.com
 
 Help/Unsubscribe/Update your Subscription:
 http://lists.apple.com/mailman/options/cocoa-dev/conrad%40synthetiqsolutions.com
 
 This email sent to con...@synthetiqsolutions.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: How to Identify if the device is used in iAD supported Regions

2011-08-04 Thread Sasikumar JP
Cornad,
I guess, Test Advertisement displays even your region App store
does not support iAD. I have seen many application in my device
displays Test Advertisement, as iAD not supported in my region.

  I agree with your approach,only if the delegate
method(bannerViewDidLoadAd:) is not getting invoked for iAD not
supported regions. But thats not the case, if Appstore supports iAD,
it Displays real ad. otherwise it will display Test Ad. Either case
your delegate method would be invoked.

Any one can confirm the behaviour of iAD in the not supported region.

Thanks
Sasikumar JP

On Thu, Aug 4, 2011 at 1:33 PM, Conrad Shultz
con...@synthetiqsolutions.com wrote:
 Full disclosure: I don't use iAd, so this is based on WWDC recollection and 
 doc lookup.

 The Test Advertisement I believe only displays when you are testing during 
 development. Users will never see it.

 Keep the banner view hidden until you receive a bannerViewDidLoadAd: message 
 in the ad delegate. Presumably this just won't get called in regions that 
 don't support iAd.

 You could setup a timer to load from other ad networks if you don't receive 
 an iAd within some predetermined period.

 (Sent from my iPad.)

 --
 Conrad Shultz
 www.synthetiqsolutions.com

 On Aug 3, 2011, at 20:46, Sasikumar JP jps...@gmail.com wrote:

 I am planning to use iAD for my iOS application. As the iAD available
 only in USA,UK,France,Italia,Deutschland,España AppStores.

 I want to display iAD only for supported regions. This will avoid
 displaying Test Advertisement from iAD.I can use AdMob for all other
 regions.

 I am not sure, how to identify the iOS Device is used in supported region?

 Any help is highly appreciated.

 Thanks

 Sasikumar JP
 ___

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

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

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

 This email sent to con...@synthetiqsolutions.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: Long delay of NSPopUpButton first click

2011-08-04 Thread Rimas M.
Drawing item titles into image and caching them for later use works nice.
But I have noticed unacceptable side effect. Normally, when menu is
displayed you can press any letter key, and menu will scroll to the first
item, which title starts with that letter. In my case , NSMenuItems does not
have titles and that does not work. Looking for workaround to maintain this
functionality.
___

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

Please do not post admin requests or moderator comments to the list.
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: NSTableView with autoResizing Column: How to trigger auto-resizing after setFrame:?

2011-08-04 Thread Daniel Vollmer

On 3 Aug 2011, at 19:20, Quincey Morris wrote:

 On Aug 3, 2011, at 05:41, Daniel Vollmer wrote:
 
 Now, what I'm trying to do is resize the tableview horizontally inside the 
 scrollview *without* changing the size of the window itself[1]. I can do 
 that easily enough by modifying its frame, but this seems to ignore the 
 column auto-resizing and leaves the column at the original width. Of course, 
 I could just set the new column width explicitly, but I'm trying use the 
 autoresizing so that I can use NSViewAnimation to animate this transition.
 Any ideas on why the column autosizing doesn't work when setting the frame 
 directly? I tried calling various NSView and NSControl methods to force a 
 relayout after changing the size, but had no success.
 
 By modifying the frame of what? You should be changing the scroll view frame, 
 but you make it sound like you're changing the table view frame.

The frame of the tableview. I want the scrollview to stay the same size, only 
to display half of twice as much content (i.e. display the left half of the 
original content in twice as much detail, with the ability to scroll over to 
the 2nd half).

 Also, check that you've enabled column resizing correctly in *both* places -- 
 the column resizing behavior of the table view itself (it's a popup -- resize 
 first column/resize last column/etc)  AND the resizing behavior of the column 
 (it's a checkbox prior to Xcode 4 IIRC, and a popup in Xcode 4).

They are both enabled, and as mentioned before, the column resizing works fine 
when resizing the window itself (which in turn changes the size of the 
scrollView).

Daniel.
___

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

Please do not post admin requests or moderator comments to the list.
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: Correct way to use contextInfo with ARC

2011-08-04 Thread Charles Srstka
On Aug 3, 2011, at 8:38 PM, Kevin Bracey wrote:

 Hi All,
 
 A case of me not grasping C or/and ARC;-)
 I'm trying to pass the NSMutableArray across the void to the didEndSelector 
 so I can access it if the user clicks ok.
 
 /snippits
 
 NSMutableArray *someInfo = [NSArray arrayWithObjects:@made , @it, 
 @across,. nil];
 
 [holdAlert beginSheetModalForWindow:[self window] modalDelegate:self 
 didEndSelector:@selector( alertDidEnd:returnCode:contextInfo: ) 
 contextInfo:?how to send someInfo?];
 
 
 -(void)alertDidEnd:(NSAlert *)alert returnCode:(int)returnCode  
 contextInfo:(void  *)contextInfo
 {
// not happy maybe use a sheet and block
   NSMutableArray *holdArray = ?contextInfo?;
 
 what magic do I use to pass it in and get it out;-)

Well, I can’t test this directly, since I haven’t been able to play with ARC 
yet due to Apple not having graced us lowly second-class-citizen Mac developers 
with the Xcode 4.2 beta, but according to the docs, you should be able to do 
this by casting the array to (__bridge_retained void *) when you give it to 
beginSheetModalForWindow:modalDelegate:didEndSelector:contextInfo:, and then 
casting it to (__bridge_transfer NSMutableArray *) in your 
alertDidEnd:returnCode:contextInfo: method.

Here’s the documentation page I’m referring to:

http://clang.llvm.org/docs/AutomaticReferenceCounting.html#objects.operands.casts

Charles___

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

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

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

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


CFStringCreateWithBytes and Endianness

2011-08-04 Thread Andreas Grosam
Hi All,

I want to create a CFString using function CFStringCreateWithBytes.

CFStringRef CFStringCreateWithBytes (
   CFAllocatorRef alloc,
   const UInt8 *bytes,
   CFIndex numBytes,
   CFStringEncoding encoding,
   Boolean isExternalRepresentation
);

I suspect, the encoding parameter refers to the encoding of the source string.

My source buffer containing the string can be encoded in UTF-16LE or UTF-16BE.
I don't want to have a BOM in the resulting CFString - and the source buffer 
does not contain it either.

So, I would create it like:
CFStringRef str = CFStringCreateWithBytes(NULL, buffer, length, encoding, 
false);

where encoding corresponds to either UTF-16LE or UTF-16-BE of the source. 
That is, parameter encoding equals either kCFStringEncodingUTF16LE or 
kCFStringEncodingUTF16BE respectively.

The documentation does not tell me which source encoding would be the most 
preferred to initialize the CFString in the most efficient manner. I would 
guess this is UTF-16LE on Intel machines.

So, the question is, which one would be the most efficient - and how can I 
figure this out at compile- /runtime?
(I know how to figure the endianness of the machine)

And what happens if I just specify kCFStringEncodingUTF16 ?  Is then the source 
encoding assumed to be in host endianness? Or UTF-16BE as the Unicode Standard 
suggests?

Thanks for help!


Regards
Andreas
 


___

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

Please do not post admin requests or moderator comments to the list.
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: CFStringCreateWithBytes and Endianness

2011-08-04 Thread Fritz Anderson
On 4 Aug 2011, at 6:49 AM, Andreas Grosam wrote:

 I want to create a CFString using function CFStringCreateWithBytes.
 
 CFStringRef CFStringCreateWithBytes (
   CFAllocatorRef alloc,
   const UInt8 *bytes,
   CFIndex numBytes,
   CFStringEncoding encoding,
   Boolean isExternalRepresentation
 );
 
 I suspect, the encoding parameter refers to the encoding of the source 
 string.

The thing to bear in mind is that it is the encoding of the _source_ string. 
It's a fact about the bytes you're importing. Facts about the data aren't 
changeable at runtime, so there isn't a choice you can make when you call 
CFStringCreateWithBytes. 

 My source buffer containing the string can be encoded in UTF-16LE or UTF-16BE.
 I don't want to have a BOM in the resulting CFString - and the source buffer 
 does not contain it either.

CFString is an opaque type. You don't know how it stores its characters 
internally, and you shouldn't have to care. It might store endianness as a BOM 
in a character buffer, or as a flag in an associated data structure, or it 
might have a preferred internal endianness that you never see from the outside. 
It may or may not store the characters as UTF-16 (either endianness) at all. 
These details may vary by architecture, version of Core Foundation, and even 
from string to string.

[T]he need for a BOM arises in the context of text interchange, rather than in 
normal text processing within a closed environment. — Wikipedia, Byte order 
mark, http://en.wikipedia.org/wiki/Byte_order_mark

 The documentation does not tell me which source encoding would be the most 
 preferred to initialize the CFString in the most efficient manner. I would 
 guess this is UTF-16LE on Intel machines.

If you mean that you have control over how the bytes in the source data were 
originally written, little-endian may be a good choice, but it's only a guess, 
and guesses about the efficiency of opaque functions are worthless. If Core 
Foundation doesn't always use UTF-16 internally, there may be a conversion 
anyway, and the efficiency of the source is at most a minor consideration.

If I were less lazy, I'd look at the source of CFLite, and know for sure. The 
best way to know, however is not to guess. Prepare your source text in both 
orders, and benchmark CFStringCreateWithBytes each way. That way, you can get 
the answer that matches your actual use. You may find that byte order makes so 
little difference in speed that it needn't be a consideration.

Wikipedia says that the Unicode standard says that if there is no BOM, you 
assume the byte stream is big-endian. So if your first priority is to avoid a 
BOM, your choice is made for you: Pass kCFStringEncodingUTF16BE. Correctness is 
a much bigger consideration than the presence of two bytes. One of my slogans 
is that it's a false economy to get the wrong answer as quickly as possible.

However, assuming big-endian assumes you absolutely trust every writer of your 
source stream. If you accept a BOM, you'll be able to handle more inputs. 
Otherwise, try big-endian, and if CFStringCreateWithBytes returns NULL, try 
again with little-endian.

 And what happens if I just specify kCFStringEncodingUTF16 ?  Is then the 
 source encoding assumed to be in host endianness? Or UTF-16BE as the Unicode 
 Standard suggests?

Possibly CFStringCreateWithBytes tries it both ways, and accepts the way that 
doesn't error. Maybe, to favor the standard behavior, it tries big-endian 
first. I haven't looked at the source, and can't tell you for sure. The thing 
to do is _test_, with the kind of data you'll actually use, and you'll know.

— 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


Question about sending to PHP from Obj-C

2011-08-04 Thread Eric E. Dolecki
I have a little script sitting locally on my Mac (webserver).

http://eric.domain.com/iOS_Log/logger.php:

?
$myFile = yabba.txt;
$fh = fopen($myFile,'a') or die(can't open file);
 $query = $_GET[string];
$stringData = $query.\n;
fwrite($fh,$stringData);
 fclose($fh);
?

I am simply trying to send the PHP a small string from my app on a device.
I've seen examples of POST everywhere, but looking for GET.

Of course if I do *http://eric.domain.com/iOS_Log/logger.php?string=Foo* in
a browser it works fine.
___

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

Please do not post admin requests or moderator comments to the list.
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: Telling Auto Save, No, I'm busy now

2011-08-04 Thread Jerry Krinock
On 2011 Aug 01, at 08:14, Kevin Perry wrote:

 Canceling an autosave when -autosavingIsImplicitlyCancellable returns NO will 
 cause problems with file coordination.

Thank you, Kevin.  I believe you and Jens on this.  Indeed, when I close a 
document window, its document receives a 
saveToURL:ofType:forSaveOperation:completionHandler: message, and, as expected, 
-autosavingIsImplicitlyCancellable returns NO.

 If you absolutely cannot save when a non-cancellable autosave starts, it is 
 OK to defer the autosave until you're ready, as long as you make sure to call 
 the original completionHandler when you're done.

Makes sense, but I'm getting a crash if I begin some operations and then hit 
the 'close' button on the window while the operations are in progress…

I take the four parameters I receive in 
saveToURL:ofType:forSaveOperation:completionHandler: and put them into a 
dictionary in an NSOperation, and throw this operation onto the end my 
operation queue.  (This project was written back in 10.5 so it does not use 
GCD.)  

When this final operation runs, I send this dictionary to a selector on the 
main thread.  But the completion handler seems to contain a bomb at this point 
– it usually crashes upon receiving any message, not always in the same place.  
Often, it crashes when I send it to super's 
saveToURL:ofType:forSaveOperation:completionHandler:, which apparently tries to 
copy it, like this…

#0  0x97c68987 in _Block_copy_internal
#1  0x97c68bd8 in _Block_object_assign
#2  0x97123a41 in __copy_helper_block_138
#3  0x97c67f86 in _Block_call_copy_helper
#4  0x97c689d3 in _Block_copy_internal
#5  0x97c68bd8 in _Block_object_assign
#6  0x9713f43b in __copy_helper_block_40
#7  0x97c67f86 in _Block_call_copy_helper
#8  0x97c689d3 in _Block_copy_internal
#9  0x9bb22eae in _dispatch_Block_copy
#10 0x9bb251ea in dispatch_async
#11 0x9713ac9c in -[NSDocument performAsynchronousFileAccessUsingBlock:]
#12 0x97123688 in -[NSDocument 
saveToURL:ofType:forSaveOperation:completionHandler:]

Retaining the completionHandler a half dozen times, with no corresponding 
releases, before placing into the dictionary, does not help.  So apparently 
it's not memory management.

I also get a crash if I instead save using the old-fashioned method, and then 
invoke the completion handler manually…

NSError* error = nil ;
BOOL ok = [super saveToURL:url
ofType:typeName
  forSaveOperation:saveOperation
 error:error] ;
completionHandler(error) ;

In this case, the saveToURL completes successfully, but it crashes when I 
invoke the completion handler.

So I tried just forgetting the completion handler, commenting out that last 
line, but then I get a crash later, it looks like, when the dictionary is 
deallocced and the completion handler gets a CFRelease().

Finally, I tried just forgetting the completion handler, not even entering it 
into the dictionary. No crash.  However, as you predicted…

 your application be blocked until the completionHandler is called

I wasn't sure what you meant by that, since the main thread is not blocked.  
Actually, I can continue editing the document.  However it hangs if I later try 
to close the document…

#0  0x995d5c5e in semaphore_wait_trap
#1  0x9bb26874 in _dispatch_semaphore_wait_slow
#2  0x9bb26970 in dispatch_semaphore_wait
#3  0x9713b135 in -[NSDocument 
performActivityWithSynchronousWaiting:usingBlock:]
#4  0x97126cf4 in -[NSDocument 
canCloseDocumentWithDelegate:shouldCloseSelector:contextInfo:]
#5  0x0018aca3 in -[MyDocument continueCanCloseWithInfo:] at 
MyDocument.m:456

or save the document…

#0  0x995d5c5e in semaphore_wait_trap
#1  0x9bb26874 in _dispatch_semaphore_wait_slow
#2  0x9bb26970 in dispatch_semaphore_wait
#3  0x9713b135 in -[NSDocument 
performActivityWithSynchronousWaiting:usingBlock:]
#4  0x971205cd in -[NSDocument 
saveDocumentWithDelegate:didSaveSelector:contextInfo:]
#5  0x971201e0 in -[NSDocument saveDocument:]
#6  0x00186755 in -[MyDocument saveDocumentFinalAsAs:] at MyDocument.m:1651

What could it be about this completion handler object that causes it to become 
a bomb after sitting in a dictionary for a few seconds?

Thank you,

Jerry

___

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

Please do not post admin requests or moderator comments to the list.
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 sending to PHP from Obj-C

2011-08-04 Thread Joe Wollard
http://developer.apple.com/library/mac/#documentation/Cocoa/Reference/Foundation/Classes/NSString_Class/Reference/NSString.html%23//apple_ref/occ/instm/NSString/writeToURL:atomically:encoding:error:

I'd guess that you could create an NSURL object with the full GET string, then 
write an empty string to that url. Something like this completely off-the-cuff 
code:

NSURL *url = [NSURL 
URLWithString:@http://eric.domain.com/iOS_Log/logger.php?string=Foo;];
NSString *emptyString = @;

[emptyString writeToURL:url atomically:NO encoding:NSUTF8StringEncoding 
error:NULL];


...come to think of it, since you're doing a GET you could probably just 
readFromURL and then discard the resulting NSString object. The point is 
basically that all of your data is going to be in the NSURL for the GET 
request, all you need to do is touch that URL via some method.



On Aug 4, 2011, at 9:52 AM, Eric E. Dolecki wrote:

 I have a little script sitting locally on my Mac (webserver).
 
 http://eric.domain.com/iOS_Log/logger.php:
 
 ?
 $myFile = yabba.txt;
 $fh = fopen($myFile,'a') or die(can't open file);
 $query = $_GET[string];
 $stringData = $query.\n;
 fwrite($fh,$stringData);
 fclose($fh);
 ?
 
 I am simply trying to send the PHP a small string from my app on a device.
 I've seen examples of POST everywhere, but looking for GET.
 
 Of course if I do *http://eric.domain.com/iOS_Log/logger.php?string=Foo* in
 a browser it works fine.
 ___
 
 Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)
 
 Please do not post admin requests or moderator comments to the list.
 Contact the moderators at cocoa-dev-admins(at)lists.apple.com
 
 Help/Unsubscribe/Update your Subscription:
 http://lists.apple.com/mailman/options/cocoa-dev/joe.wollard%40gmail.com
 
 This email sent to joe.woll...@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: Telling Auto Save, No, I'm busy now

2011-08-04 Thread Ken Thomases
On Aug 4, 2011, at 8:54 AM, Jerry Krinock wrote:

 I'm getting a crash if I begin some operations and then hit the 'close' 
 button on the window while the operations are in progress…
 
 I take the four parameters I receive in 
 saveToURL:ofType:forSaveOperation:completionHandler: and put them into a 
 dictionary in an NSOperation, and throw this operation onto the end my 
 operation queue.  (This project was written back in 10.5 so it does not use 
 GCD.)  

Did you copy the block, or did you just add it to the dictionary as a value 
(which just retains it)?  You need to copy it and then later release it.


 When this final operation runs, I send this dictionary to a selector on the 
 main thread.  But the completion handler seems to contain a bomb at this 
 point – it usually crashes upon receiving any message, not always in the same 
 place.  Often, it crashes when I send it to super's 
 saveToURL:ofType:forSaveOperation:completionHandler:, which apparently tries 
 to copy it, like this…
 
 #00x97c68987 in _Block_copy_internal
 #10x97c68bd8 in _Block_object_assign
 #20x97123a41 in __copy_helper_block_138
 #30x97c67f86 in _Block_call_copy_helper
 #40x97c689d3 in _Block_copy_internal
 #50x97c68bd8 in _Block_object_assign
 #60x9713f43b in __copy_helper_block_40
 #70x97c67f86 in _Block_call_copy_helper
 #80x97c689d3 in _Block_copy_internal
 #90x9bb22eae in _dispatch_Block_copy
 #10   0x9bb251ea in dispatch_async
 #11   0x9713ac9c in -[NSDocument performAsynchronousFileAccessUsingBlock:]
 #12   0x97123688 in -[NSDocument 
 saveToURL:ofType:forSaveOperation:completionHandler:]

This suggests that you didn't copy it.  Thus, the above is the first time it 
has been copied, which attempts to relocated it off of its original stack frame 
and into the heap.  However, that stack frame is long gone and no longer valid.


 Retaining the completionHandler a half dozen times, with no corresponding 
 releases, before placing into the dictionary, does not help.  So apparently 
 it's not memory management.

Blocks have special memory management requirements and retaining is not 
sufficient if the block is to survive its original stack frame.

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: Question about sending to PHP from Obj-C

2011-08-04 Thread Keary Suska
On Aug 4, 2011, at 7:52 AM, Eric E. Dolecki wrote:

 I have a little script sitting locally on my Mac (webserver).
 
 http://eric.domain.com/iOS_Log/logger.php:
 
 ?
 $myFile = yabba.txt;
 $fh = fopen($myFile,'a') or die(can't open file);
 $query = $_GET[string];
 $stringData = $query.\n;
 fwrite($fh,$stringData);
 fclose($fh);
 ?

Just a note that it is not useful to post the PHP code--not only is it not 
relevant to your case, there is no guarantee that list members are familiar 
enough with PHP to make real sense of it.

 I am simply trying to send the PHP a small string from my app on a device.
 I've seen examples of POST everywhere, but looking for GET.
 
 Of course if I do *http://eric.domain.com/iOS_Log/logger.php?string=Foo* in
 a browser it works fine.

Anyway--can you be more specific about your problem? Regarding specifying query 
strings, Cocoa doesn't provide any convenient means that I know of to build 
query strings so you have to manually assemble them. Something like:

NSString *urlString = [NSString 
stringWithFormat:@http://eric.domain.com/iOS_Log/logger.php?string=%@;, [foo 
stringByAddingPercentEscapesUsingEncoding:NSASCIIStringEncoding]];
NSURL *url = [NSURL  URLWithString: urlString];

HTH,

Keary Suska
Esoteritech, Inc.
Demystifying technology for your home or business

___

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

Please do not post admin requests or moderator comments to the list.
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: Telling Auto Save, No, I'm busy now

2011-08-04 Thread Jerry Krinock

On 2011 Aug 04, at 07:53, Ken Thomases wrote:

 On Aug 4, 2011, at 8:54 AM, Jerry Krinock wrote:
 
 I'm getting a crash if I begin some operations and then hit the 'close' 
 button on the window while the operations are in progress…
 
 I take the four parameters I receive in 
 saveToURL:ofType:forSaveOperation:completionHandler: and put them into a 
 dictionary in an NSOperation, and throw this operation onto the end my 
 operation queue.  (This project was written back in 10.5 so it does not use 
 GCD.)  
 
 Did you copy the block, or did you just add it to the dictionary as a value 
 (which just retains it)?

The latter, Ken.  I didn't mention that I was a newbie on Blocks, having just 
read Blocks Programming Topics yesterday.  Copying Blocks was near the end 
… looks like I must have fallen asleep.

 This suggests that you didn't copy it.  Thus, the above is the first time it 
 has been copied, which attempts to relocated it off of its original stack 
 frame and into the heap.  However, that stack frame is long gone and no 
 longer valid.

Yup.

 Blocks have special memory management requirements and retaining is not 
 sufficient if the block is to survive its original stack frame.

OK, I'll go do the homework.

Thank you.

___

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

Please do not post admin requests or moderator comments to the list.
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: Telling Auto Save, No, I'm busy now

2011-08-04 Thread Kevin Perry
What Ken said.

Also, it might be more convenient to use NSBlockOperation or 
-addOperationWithBlock so the function parameters (including the completion 
handler) are all captured correctly for you automatically. It's a lot more 
convenient than stashing things in an NSDictionary.

Finally, I misspoke about the application blocking when you defer calling the 
completion handler. User interaction blocking for async saving doesn't get 
invoked until much later. As a result, yes the user can continue editing the 
document, which I suppose is OK since the pending autosave will pick up those 
changes as well. However, since -autosaveWithImplicitCancellability:… uses 
-performAsynchronousFileAccessUsingBlock:, any further attempts to gain access 
to the file will block the main thread, so you'll need to use 
-continueAsynchronousWorkOnMainQueueUsingBlock: to avoid a potential deadlock 
when reinvoking the -saveToURL: method on the main queue.

Also, what I said about other applications blocking trying to get sole access 
to the file via file coordination is still true.

-KP

On Aug 4, 2011, at 7:53 AM, Ken Thomases wrote:

 On Aug 4, 2011, at 8:54 AM, Jerry Krinock wrote:
 
 I'm getting a crash if I begin some operations and then hit the 'close' 
 button on the window while the operations are in progress…
 
 I take the four parameters I receive in 
 saveToURL:ofType:forSaveOperation:completionHandler: and put them into a 
 dictionary in an NSOperation, and throw this operation onto the end my 
 operation queue.  (This project was written back in 10.5 so it does not use 
 GCD.)  
 
 Did you copy the block, or did you just add it to the dictionary as a value 
 (which just retains it)?  You need to copy it and then later release it.
 
 
 When this final operation runs, I send this dictionary to a selector on the 
 main thread.  But the completion handler seems to contain a bomb at this 
 point – it usually crashes upon receiving any message, not always in the 
 same place.  Often, it crashes when I send it to super's 
 saveToURL:ofType:forSaveOperation:completionHandler:, which apparently tries 
 to copy it, like this…
 
 #0   0x97c68987 in _Block_copy_internal
 #1   0x97c68bd8 in _Block_object_assign
 #2   0x97123a41 in __copy_helper_block_138
 #3   0x97c67f86 in _Block_call_copy_helper
 #4   0x97c689d3 in _Block_copy_internal
 #5   0x97c68bd8 in _Block_object_assign
 #6   0x9713f43b in __copy_helper_block_40
 #7   0x97c67f86 in _Block_call_copy_helper
 #8   0x97c689d3 in _Block_copy_internal
 #9   0x9bb22eae in _dispatch_Block_copy
 #10  0x9bb251ea in dispatch_async
 #11  0x9713ac9c in -[NSDocument performAsynchronousFileAccessUsingBlock:]
 #12  0x97123688 in -[NSDocument 
 saveToURL:ofType:forSaveOperation:completionHandler:]
 
 This suggests that you didn't copy it.  Thus, the above is the first time it 
 has been copied, which attempts to relocated it off of its original stack 
 frame and into the heap.  However, that stack frame is long gone and no 
 longer valid.
 
 
 Retaining the completionHandler a half dozen times, with no corresponding 
 releases, before placing into the dictionary, does not help.  So apparently 
 it's not memory management.
 
 Blocks have special memory management requirements and retaining is not 
 sufficient if the block is to survive its original stack frame.
 
 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/kperry%40apple.com
 
 This email sent to kpe...@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


Menu Item Key Equivalent

2011-08-04 Thread koko
I have set the key equivalent for a menu item to  A not cmd-A just plain A.

I have other key equivalents set to numbers 0 , 1 , 3.

If I hit 0, 1 or 3 the menu action method is called.

If I hit A the menu action is not called.

Where am I wrong?

-koko
___

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

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

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

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


Re: How to Identify if the device is used in iAD supported Regions

2011-08-04 Thread Conrad Shultz
Wow, if that's really the behavior then I'd say you should definitely file a 
bug.

Not only should users never see debug/test junk, but it would be ridiculous for 
you to have to hard code region support... without an API how would you handle 
addition or removal of a region? You shouldn't have to push out a new app. 

FWIW, given the absence of mention of iAd at WWDC this year and the publicized 
lack of enthusiasm among advertisers (at least in the US), I would not be 
surprised to see iAd revamped or even dropped. But this is purely speculative. 

(Sent from my iPhone.)

--
Conrad Shultz
www.synthetiqsolutions.com

On Aug 4, 2011, at 1:28, Sasikumar JP jps...@gmail.com wrote:

 Cornad,
I guess, Test Advertisement displays even your region App store
 does not support iAD. I have seen many application in my device
 displays Test Advertisement, as iAD not supported in my region.
 
  I agree with your approach,only if the delegate
 method(bannerViewDidLoadAd:) is not getting invoked for iAD not
 supported regions. But thats not the case, if Appstore supports iAD,
 it Displays real ad. otherwise it will display Test Ad. Either case
 your delegate method would be invoked.
 
 Any one can confirm the behaviour of iAD in the not supported region.
 
 Thanks
 Sasikumar JP
 
 On Thu, Aug 4, 2011 at 1:33 PM, Conrad Shultz
 con...@synthetiqsolutions.com wrote:
 Full disclosure: I don't use iAd, so this is based on WWDC recollection and 
 doc lookup.
 
 The Test Advertisement I believe only displays when you are testing during 
 development. Users will never see it.
 
 Keep the banner view hidden until you receive a bannerViewDidLoadAd: message 
 in the ad delegate. Presumably this just won't get called in regions that 
 don't support iAd.
 
 You could setup a timer to load from other ad networks if you don't receive 
 an iAd within some predetermined period.
 
 (Sent from my iPad.)
 
 --
 Conrad Shultz
 www.synthetiqsolutions.com
 
 On Aug 3, 2011, at 20:46, Sasikumar JP jps...@gmail.com wrote:
 
 I am planning to use iAD for my iOS application. As the iAD available
 only in USA,UK,France,Italia,Deutschland,España AppStores.
 
 I want to display iAD only for supported regions. This will avoid
 displaying Test Advertisement from iAD.I can use AdMob for all other
 regions.
 
 I am not sure, how to identify the iOS Device is used in supported region?
 
 Any help is highly appreciated.
 
 Thanks
 
 Sasikumar JP
 ___
 
 Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)
 
 Please do not post admin requests or moderator comments to the list.
 Contact the moderators at cocoa-dev-admins(at)lists.apple.com
 
 Help/Unsubscribe/Update your Subscription:
 http://lists.apple.com/mailman/options/cocoa-dev/conrad%40synthetiqsolutions.com
 
 This email sent to con...@synthetiqsolutions.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


Symbol not found: _OBJC_CLASS_$_NSURL

2011-08-04 Thread koko
My App has run on this users machine for quite some time now.  I just did a new 
build changing nothing related to NSURL.

Now when this user runs the app she gets this message:

Dyld Error Message:
Symbol not found: _OBJC_CLASS_$_NSURL
Referenced from: /Applications/Convert It Mac.app/Contents/MacOS/Convert It Mac
Expected in: 
/System/Library/Frameworks/CoreFoundation.framework/Versions/A/CoreFoundation

NSURL has been around since Moses.  Do this indicate a problem with her machine?


-koko


___

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

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

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

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


Re: Symbol not found: _OBJC_CLASS_$_NSURL

2011-08-04 Thread Jean-Daniel Dupas
Le 4 août 2011 à 18:46, koko a écrit :

 My App has run on this users machine for quite some time now.  I just did a 
 new build changing nothing related to NSURL.
 
 Now when this user runs the app she gets this message:
 
 Dyld Error Message:
 Symbol not found: _OBJC_CLASS_$_NSURL
 Referenced from: /Applications/Convert It Mac.app/Contents/MacOS/Convert It 
 Mac
 Expected in: 
 /System/Library/Frameworks/CoreFoundation.framework/Versions/A/CoreFoundation
 
 NSURL has been around since Moses.  Do this indicate a problem with her 
 machine?
 


You probably either change the Deployment version, or the SDK setting.

NSURL has been around since Moses, but until recent changes in OS X, it was in 
Foundation framework, not in CoreFoundation.



-- Jean-Daniel




___

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

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

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

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


Re: How to Identify if the device is used in iAD supported Regions

2011-08-04 Thread Howard Siegel
Haven't yet ventured in to iAd territory and don't know any of the data
objects involved,
so could be off in left field here.

Since you will always get the -bannerViewDidLoadAd: delegate callback, even
for the test ad, would it be possible to look inside the ad data to see if
it is the
test ad and just ignore it?

- h

On Thu, Aug 4, 2011 at 09:03, Conrad Shultz
con...@synthetiqsolutions.comwrote:

 Wow, if that's really the behavior then I'd say you should definitely file
 a bug.

 Not only should users never see debug/test junk, but it would be ridiculous
 for you to have to hard code region support... without an API how would you
 handle addition or removal of a region? You shouldn't have to push out a new
 app.

 FWIW, given the absence of mention of iAd at WWDC this year and the
 publicized lack of enthusiasm among advertisers (at least in the US), I
 would not be surprised to see iAd revamped or even dropped. But this is
 purely speculative.

 (Sent from my iPhone.)

 --
 Conrad Shultz
 www.synthetiqsolutions.com

 On Aug 4, 2011, at 1:28, Sasikumar JP jps...@gmail.com wrote:

  Cornad,
 I guess, Test Advertisement displays even your region App store
  does not support iAD. I have seen many application in my device
  displays Test Advertisement, as iAD not supported in my region.
 
   I agree with your approach,only if the delegate
  method(bannerViewDidLoadAd:) is not getting invoked for iAD not
  supported regions. But thats not the case, if Appstore supports iAD,
  it Displays real ad. otherwise it will display Test Ad. Either case
  your delegate method would be invoked.
 
  Any one can confirm the behaviour of iAD in the not supported region.
 
  Thanks
  Sasikumar JP
 
  On Thu, Aug 4, 2011 at 1:33 PM, Conrad Shultz
  con...@synthetiqsolutions.com wrote:
  Full disclosure: I don't use iAd, so this is based on WWDC recollection
 and doc lookup.
 
  The Test Advertisement I believe only displays when you are testing
 during development. Users will never see it.
 
  Keep the banner view hidden until you receive a bannerViewDidLoadAd:
 message in the ad delegate. Presumably this just won't get called in regions
 that don't support iAd.
 
  You could setup a timer to load from other ad networks if you don't
 receive an iAd within some predetermined period.
 
  (Sent from my iPad.)
 
  --
  Conrad Shultz
  www.synthetiqsolutions.com
 
  On Aug 3, 2011, at 20:46, Sasikumar JP jps...@gmail.com wrote:
 
  I am planning to use iAD for my iOS application. As the iAD available
  only in USA,UK,France,Italia,Deutschland,España AppStores.
 
  I want to display iAD only for supported regions. This will avoid
  displaying Test Advertisement from iAD.I can use AdMob for all other
  regions.
 
  I am not sure, how to identify the iOS Device is used in supported
 region?
 
  Any help is highly appreciated.
 
  Thanks
 
  Sasikumar JP
  ___
 
  Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)
 
  Please do not post admin requests or moderator comments to the list.
  Contact the moderators at cocoa-dev-admins(at)lists.apple.com
 
  Help/Unsubscribe/Update your Subscription:
 
 http://lists.apple.com/mailman/options/cocoa-dev/conrad%40synthetiqsolutions.com
 
  This email sent to con...@synthetiqsolutions.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/hsiegel%40gmail.com

 This email sent to hsie...@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: How to Identify if the device is used in iAD supported Regions

2011-08-04 Thread David Duncan
If you find that your application is displaying the test ad on a 
non-development device after deploying to the App Store, then file a bug.

The App Store build of your application should not be seeing the test ad on 
consumer devices. If you ran the App Store version of your application on a 
development device prior to iOS 4.3, there are cases where you will 
persistently see the test ad when you should not (on 4.3 or later this should 
only happen if you run the App Store and development builds in rapid 
succession). This should only occur on devices that you used for development of 
that application (this includes any device that has ever run a non-App Store 
version of the application).

So to summarize, this should work exactly as Conrad described it for your 
customers. If it does not, file a bug.

On Aug 4, 2011, at 1:28 AM, Sasikumar JP wrote:

I guess, Test Advertisement displays even your region App store
 does not support iAD. I have seen many application in my device
 displays Test Advertisement, as iAD not supported in my region.
 
  I agree with your approach,only if the delegate
 method(bannerViewDidLoadAd:) is not getting invoked for iAD not
 supported regions. But thats not the case, if Appstore supports iAD,
 it Displays real ad. otherwise it will display Test Ad. Either case
 your delegate method would be invoked.
 
 Any one can confirm the behaviour of iAD in the not supported region.

--
David Duncan

___

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

Please do not post admin requests or moderator comments to the list.
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] Block animation kills performance

2011-08-04 Thread Matt Neuburg
On Sun, 31 Jul 2011 16:20:48 -0700, Rick Mann rm...@latencyzero.com said:
Xcode 3.2.6, iOS 4.3.

My app shows a heartbeat as a flashing red square. Once each second, I execute 
the following code. If I use the block style, overall performance of the app 
suffers greatly (the UI becomes unresponsive to touches). If I animate the 
more traditional way, UI responsiveness seems normal.

This occurs in both the simulator and the device (iPad).

Am I doing something wrong?

My book is clear on this point:

http://www.apeth.com/iOSBook/ch17.html#_block_based_view_animation

User touch interactions are disabled during the animation, by default [i.e., 
when using what you call the block style]. This is not the case with an 
animation block [i.e. when using what you call the traditional way]. The 
optionUIViewAnimationOptionAllowUserInteraction lets you reverse this setting.

m.

--
matt neuburg, phd = m...@tidbits.com, http://www.apeth.net/matt/
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: Unnecessary Boolean Warning

2011-08-04 Thread Boyd Collier
At the risk of offending contributors to this list, whose knowledge and 
helpfulness I greatly respect, may I suggest that this thread has gone on long 
enough and that competing opinions on this topic would be better aired on some 
other list?

Boyd___

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

Please do not post admin requests or moderator comments to the list.
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: Menu Item Key Equivalent

2011-08-04 Thread Kyle Sluder
On Thu, Aug 4, 2011 at 9:17 AM, koko k...@highrolls.net wrote:
 I have set the key equivalent for a menu item to  A not cmd-A just plain A.

 I have other key equivalents set to numbers 0 , 1 , 3.

 If I hit 0, 1 or 3 the menu action method is called.

 If I hit A the menu action is not called.

 Where am I wrong?

Did you remember to remove the Cmd-A key equivalent from Edit  Select All?

--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: finding my UIViewController

2011-08-04 Thread Matt Neuburg
On Thu, 04 Aug 2011 00:07:40 +0800, Roland King r...@rols.org said:
Is there any way to find, given a UIView, what the closest presenting 
UIViewController is? 

Walk the responder chain until you come to a UIViewController?

UIResponder* r = self;
while (![r isKindOfClass: [UIViewController class]])
r = [r nextResponder];

m.

--
matt neuburg, phd = m...@tidbits.com, http://www.apeth.net/matt/
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: NSTableView with autoResizing Column: How to trigger auto-resizing after setFrame:?

2011-08-04 Thread Quincey Morris
On Aug 4, 2011, at 03:12, Daniel Vollmer wrote:

 On 3 Aug 2011, at 19:20, Quincey Morris wrote:
 
 By modifying the frame of what? You should be changing the scroll view 
 frame, but you make it sound like you're changing the table view frame.
 
 The frame of the tableview. I want the scrollview to stay the same size, only 
 to display half of twice as much content (i.e. display the left half of the 
 original content in twice as much detail, with the ability to scroll over to 
 the 2nd half).

The relationship between the table view and the scroll view is more intimate 
than that. The view hierarchy (not all shown in IB) is scroll view -- clip 
view -- document view, and in this case the document view is the table view. 
The only way you can *directly* have the table view be half of the scroll 
view's content is to mess with the scroll view's internal layout, and that 
may violate the table view's assumptions about its relationship to the 
enclosing views.

If you want to have other content that scrolls along with the table view 
inside the scroll view (which I *think* is what you're trying to do), then the 
correct way to do it is to enclose the table view (along with its own scroll 
view) and the associated content in a containing scroll view (which means the 
table view's scroll view and the other content will be enclosed in a custom 
view that's the outer scroll view's document view). The inner scroll view 
would be set to autoresize, so it basically has no effect, all the resizing 
being driven by the outer scroll view.

While it may seem ridiculous to have the extra, useless, inner scroll view, 
it's actually just easer to go with the flow on this. You can *try* to divorce 
a table view from the scroll view that IB creates for it, but IMO it isn't 
worth the effort or the pain.


___

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

Please do not post admin requests or moderator comments to the list.
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] Block animation kills performance

2011-08-04 Thread Rick Mann
Thanks!

On Aug 4, 2011, at 11:02 , Matt Neuburg wrote:

 On Sun, 31 Jul 2011 16:20:48 -0700, Rick Mann rm...@latencyzero.com said:
 Xcode 3.2.6, iOS 4.3.
 
 My app shows a heartbeat as a flashing red square. Once each second, I 
 execute the following code. If I use the block style, overall performance of 
 the app suffers greatly (the UI becomes unresponsive to touches). If I 
 animate the more traditional way, UI responsiveness seems normal.
 
 This occurs in both the simulator and the device (iPad).
 
 Am I doing something wrong?
 
 My book is clear on this point:
 
 http://www.apeth.com/iOSBook/ch17.html#_block_based_view_animation
 
 User touch interactions are disabled during the animation, by default [i.e., 
 when using what you call the block style]. This is not the case with an 
 animation block [i.e. when using what you call the traditional way]. The 
 optionUIViewAnimationOptionAllowUserInteraction lets you reverse this 
 setting.
 
 m.
 
 --
 matt neuburg, phd = m...@tidbits.com, http://www.apeth.net/matt/
 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: UITableViewController, with table view not the root of its nib?

2011-08-04 Thread Matt Neuburg
On Wed, 03 Aug 2011 13:49:10 -0700, Jens Alfke j...@mooseyard.com said:
As far as I can tell, UITableViewController only works when the table is the 
root of the nib

That's basically right. The docs are very clear on this: you must not use 
UITableViewController unless the table view *is* the whole controlled view:

Note: You should use a UIViewController subclass rather than a subclass of 
UITableViewController to manage a table view if the view to be managed is 
composed of multiple subviews, one of which is a table view. The default 
behavior of the UITableViewController class is to make the table view fill the 
screen between the navigation bar and the tab bar (if either are present).

However, use of a UITableViewController doesn't really net you any 
functionality you can't implement yourself, so this should not be a big issue. 
m.

--
matt neuburg, phd = m...@tidbits.com, http://www.apeth.net/matt/
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


view:(QTMovieView *)view willDisplayImage:

2011-08-04 Thread julius
Hi,
I've been looking for a way to draw on top of a QT movie whose display 
dimensions the user can vary using the window's resize handle(?) while it is 
running.

I have previously stepped through the individual frames but the result was 
jerky.
I obtained a smoother result by first converting the movie into an image 
sequence but the time required to perform the convertion and memory use are 
unacceptable.

The most promising suggestion I've found so far is the (undocumented) delegate 
method in QTMovieView.h
- (CIImage *)view:(QTMovieView *)view willDisplayImage:(CIImage *)image

Some discussions on various forums circa 2008, suggest the method had been used 
successfully in the past but it's not worked for me.
XCode seems not to recognise it.

Is the method no longer extant?
Should I look to try another approach e.g. Core Video?
I use XCode 3.2.6 

Julius

http://juliuspaintings.co.uk



___

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

Please do not post admin requests or moderator comments to the list.
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: view:(QTMovieView *)view willDisplayImage:

2011-08-04 Thread Mike Abdullah
Have you tried putting both the movie view, and a custom overlay inside of a 
layer-backed view?

The more traditional route I think is to add a child window for the overlay, 
keeping its size/placement in sync with the parent window

Sent from my iPad

On 4 Aug 2011, at 08:13 PM, julius jul...@juliuspaintings.co.uk wrote:

 Hi,
 I've been looking for a way to draw on top of a QT movie whose display 
 dimensions the user can vary using the window's resize handle(?) while it is 
 running.
 
 I have previously stepped through the individual frames but the result was 
 jerky.
 I obtained a smoother result by first converting the movie into an image 
 sequence but the time required to perform the convertion and memory use are 
 unacceptable.
 
 The most promising suggestion I've found so far is the (undocumented) 
 delegate method in QTMovieView.h
 - (CIImage *)view:(QTMovieView *)view willDisplayImage:(CIImage *)image
 
 Some discussions on various forums circa 2008, suggest the method had been 
 used successfully in the past but it's not worked for me.
 XCode seems not to recognise it.
 
 Is the method no longer extant?
 Should I look to try another approach e.g. Core Video?
 I use XCode 3.2.6 
 
 Julius
 
 http://juliuspaintings.co.uk
 
 
 
 ___
 
 Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)
 
 Please do not post admin requests or moderator comments to the list.
 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


Re: Symbol not found: _OBJC_CLASS_$_NSURL

2011-08-04 Thread koko
Thanks !  

Now I remember reading about this somewhere ... NSURL moving from one framework 
to another.

-koko


On Aug 4, 2011, at 10:59 AM, Jean-Daniel Dupas wrote:

 Le 4 août 2011 à 18:46, koko a écrit :
 
 My App has run on this users machine for quite some time now.  I just did a 
 new build changing nothing related to NSURL.
 
 Now when this user runs the app she gets this message:
 
 Dyld Error Message:
 Symbol not found: _OBJC_CLASS_$_NSURL
 Referenced from: /Applications/Convert It Mac.app/Contents/MacOS/Convert It 
 Mac
 Expected in: 
 /System/Library/Frameworks/CoreFoundation.framework/Versions/A/CoreFoundation
 
 NSURL has been around since Moses.  Do this indicate a problem with her 
 machine?
 
 
 
 You probably either change the Deployment version, or the SDK setting.
 
 NSURL has been around since Moses, but until recent changes in OS X, it was 
 in Foundation framework, not in CoreFoundation.
 
 
 
 -- Jean-Daniel
 
 
 
 
 

___

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

Please do not post admin requests or moderator comments to the list.
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: view:(QTMovieView *)view willDisplayImage:

2011-08-04 Thread julius

On 4 Aug 2011, at 20:25, Mike Abdullah wrote:

 Have you tried putting both the movie view, and a custom overlay inside of a 
 layer-backed view?
 
 The more traditional route I think is to add a child window for the overlay, 
 keeping its size/placement in sync with the parent window
 
Hi Mike
thanks.
I'll take a good look at both of these.
Best wishes
Julius

http://juliuspaintings.co.uk



___

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

Please do not post admin requests or moderator comments to the list.
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: Menu Item Key Equivalent

2011-08-04 Thread koko
Is not cmd-A and A different? Why would cmd-A need to be removed?

-koko

On Aug 4, 2011, at 12:18 PM, Kyle Sluder wrote:

 On Thu, Aug 4, 2011 at 9:17 AM, koko k...@highrolls.net wrote:
 I have set the key equivalent for a menu item to  A not cmd-A just plain A.
 
 I have other key equivalents set to numbers 0 , 1 , 3.
 
 If I hit 0, 1 or 3 the menu action method is called.
 
 If I hit A the menu action is not called.
 
 Where am I wrong?
 
 Did you remember to remove the Cmd-A key equivalent from Edit  Select All?
 
 --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: Menu Item Key Equivalent

2011-08-04 Thread Kyle Sluder
On Thu, Aug 4, 2011 at 1:06 PM, koko k...@highrolls.net wrote:
 Is not cmd-A and A different? Why would cmd-A need to be removed?

Oh, I misread.

Is this even supported? The key equivalent machinery might not
dispatch non-modified characters to menus…

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


CoreData I/O error for database: no such table

2011-08-04 Thread Nick Zitzmann
I tried searching around and found one other person who had the same 
problem[1], but no one followed up with a good solution for existing databases.

I have an entity with a many-to-many relationship to itself, called parents 
and children. And when I take a database that was made by an application 
built by Xcode 3.2.6 and move that application to Xcode 4.1, I'm now getting 
this error when trying to look up something in that entity:

I/O error for database at /path/to/mydatabase.db.  SQLite error code:1, 'no 
such table: Z_16PARENTS'

It looks like the model compiler made a subtle change to the many-to-many table 
that is part of the model used to make the database during the switch. How do I 
make it so that it uses the same tables that it used to use? Throwing out and 
rebuilding the existing database is not an option.

I already tried changing the Mac OS X deployment target, since I noticed that 
the deployment target is passed to momc, but that did not make any difference.

I was able to work around the problem by creating a custom build rule that 
builds the data model using Xcode 3's momc tool instead of Xcode 4's tool, and 
while that did solve the problem, there has got to be a better way. But what is 
that way? I can't believe Xcode 4 would ship with such a regression in momc...

Nick Zitzmann
http://www.chronosnet.com/

[1] 
http://www.cocoabuilder.com/archive/cocoa/306002-core-data-o-error-no-such-column.html

___

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

Please do not post admin requests or moderator comments to the list.
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: Menu Item Key Equivalent

2011-08-04 Thread koko
The reason I have tried is that in the same menu I use 0,1,3,6 without cmd 
modifier and they work just fine.

FYI This is a a Zoom Menu 

A = zoom all
S = zoom  selected

0 = zoom to hoop
1 = zoom 1:1
3 = zoom 3:1
6 = zoom 6:1


On Aug 4, 2011, at 2:18 PM, Kyle Sluder wrote:

 On Thu, Aug 4, 2011 at 1:06 PM, koko k...@highrolls.net wrote:
 Is not cmd-A and A different? Why would cmd-A need to be removed?
 
 Oh, I misread.
 
 Is this even supported? The key equivalent machinery might not
 dispatch non-modified characters to menus…
 
 --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


Core Data Concurrency Issues

2011-08-04 Thread Jeff Kelley
I’m having some issues with concurrency with Core Data. I create an object
that has a to-many relationship with another object (which in turn has a
to-one reciprocal relationship with the first object), then dispatch_async
onto a private queue. In that queue, I use a separate managed object
context, which I’ve created earlier and only use within that queue. Here’s a
snippet:

ParentObject *parent = [NSEntityDescription
insertNewObjectForEntityName:@ParentObject]
inContext:[self moc]];

NSManagedObjectID *objectID = [parent objectID];

dispatch_async(dedicatedQueue, ^{
// Note: childContext is an NSManagedObjectContext that has been created
earlier and is only used within this queue.
 ParentObject *parent = [childContext objectWithID:userID];

for (NSDictionary *jsonDict in allChildDicts) {
 ChildObject *child = [NSEntityDescription
insertNewObjectForEntityName:@ChildObject]
inContext:childContext];
[parent addChildObject:child];
 }
});


If I try to save the context within the dedicated queue, I get validation
errors on the child objects with the text “Dangling reference to an invalid
object.”

It appears to work correctly if I create the parent object within the
dedicated child queue. So, what is the proper way to create these objects on
the main queue and then update them in the background? Thanks in advance.

Jeff Kelley
___

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

Please do not post admin requests or moderator comments to the list.
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: Correct way to use contextInfo with ARC

2011-08-04 Thread Ron Hunsinger

On Aug 3, 2011, at 6:38 PM, Kevin Bracey wrote:

 NSMutableArray *someInfo = [NSArray arrayWithObjects:@made , @it, 
 @across,. nil];

Did you really want to create an NSArray (non-mutable) and then pass it off as 
an NSMutableArray? Since you mentioned ARC, I'm surprised the compiler didn't 
flag the type mismatch. You might have better luck creating the NSMutableArray 
that your completion routine seems to be expecting:

NSMutableArray *someInfo = [NSMutableArray arrayWithObjects:@made , 
@it, @across,. nil];

[holdAlert beginSheetModalForWindow:[self window] modalDelegate:self 
didEndSelector:@selector( 
alertDidEnd:returnCode:contextInfo: ) contextInfo:someInfo;


-(void)alertDidEnd:(NSAlert *)alert returnCode:(int)returnCode  
contextInfo:(void  *)contextInfo
{
NSMutableArray *holdArray = (NSMutableArray*)contextInfo;
...
}

Or, if the array doesn't really need to be mutable, use NSArray throughout. The 
only reason to make it mutable would be so the completion handler could use it 
to pass information back, but of course it has the delegate itself for that.

Or, use a block. That might be simpler 
still.___

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

Please do not post admin requests or moderator comments to the list.
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 Data Concurrency Issues

2011-08-04 Thread Heath Borders
A managed object context needs to be used and created from the same thread.
Create and use childContext in a single dispatchAsync block.

-Heath
On Aug 4, 2011 5:32 PM, Jeff Kelley slauncha...@gmail.com wrote:
 I’m having some issues with concurrency with Core Data. I create an object
 that has a to-many relationship with another object (which in turn has a
 to-one reciprocal relationship with the first object), then dispatch_async
 onto a private queue. In that queue, I use a separate managed object
 context, which I’ve created earlier and only use within that queue. Here’s
a
 snippet:

 ParentObject *parent = [NSEntityDescription
 insertNewObjectForEntityName:@ParentObject]
 inContext:[self moc]];

 NSManagedObjectID *objectID = [parent objectID];

 dispatch_async(dedicatedQueue, ^{
 // Note: childContext is an NSManagedObjectContext that has been created
 earlier and is only used within this queue.
 ParentObject *parent = [childContext objectWithID:userID];

 for (NSDictionary *jsonDict in allChildDicts) {
 ChildObject *child = [NSEntityDescription
 insertNewObjectForEntityName:@ChildObject]
 inContext:childContext];
 [parent addChildObject:child];
 }
 });


 If I try to save the context within the dedicated queue, I get validation
 errors on the child objects with the text “Dangling reference to an
invalid
 object.”

 It appears to work correctly if I create the parent object within the
 dedicated child queue. So, what is the proper way to create these objects
on
 the main queue and then update them in the background? Thanks in advance.

 Jeff Kelley
 ___

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

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

 Help/Unsubscribe/Update your Subscription:
 http://lists.apple.com/mailman/options/cocoa-dev/heath.borders%40gmail.com

 This email sent to heath.bord...@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