<?xml version="1.0" encoding="ISO-8859-1"?>
<rss version="2.0">
    <channel>
        <title>Cocoa mail archive</title>
        <description><![CDATA[Cocoa and Xcode mail archive brought to you by Cocoabuilder.com]]></description>
        <link>http://www.cocoabuilder.com/archive/bydate/cocoa</link>
        <lastBuildDate>Sat, 04 Jul 2009 23:29:56 +0100</lastBuildDate>
        <generator>Mamasam RSSWriter</generator>
        <image>
            <url>http://www.cocoabuilder.com/imgs/banner.gif</url>
            <title>cocoabuilder.com logo</title>
            <link>http://www.cocoabuilder.com</link>
            <width>88</width>
            <height>31</height>
            <description>Feed provided by Cocoabuilder.com</description>
        </image>
        <language>en-us</language>
        <managingEditor>Bertrand Mansion</managingEditor>
        <item>
            <title>Fwd: Unit Testing and Run Loops</title>
            <link>http://www.cocoabuilder.com/archive/message/cocoa/2009/7/4/240301</link>
            <description><![CDATA[Thanks, I dimly recall seeing something like this before...<br /><br />On Jul 4, 2009, at 12:19 PM, A.M. wrote:<br /><br /><span class="quoted1">&gt;<br />&gt; On Jul 4, 2009, at 3:10 PM, Jamie Hardt wrote:<br /></span><br /><span class="quoted2">&gt;&gt; [...]<br />&gt;&gt; But does anyone know how to setup something like a stream read or&nbsp; <br />&gt;&gt; URL download, and make sure run loop completely services the&nbsp; <br />&gt;&gt; download/stream, and then write a unit test that makes sure all&nbsp; <br />&gt;&gt; this happens?<br /></span><br /><span class="quoted1">&gt;<br />&gt; NSTimeInterval timeout=3.0;<br />&gt; while(1)<br />&gt; {<br />&gt;&nbsp; &nbsp; &nbsp;NSTimeInterval runtime=[NSDate timeIntervalSinceReferenceDate];<br />&gt;&nbsp; &nbsp; &nbsp;[[NSRunLoop currentRunLoop] runMode:NSDefaultRunLoopMode beforeDate: <br />&gt; [NSDate dateWithTimeIntervalSinceNow:t timeout];<br />&gt;&nbsp; &nbsp; &nbsp;timeout-=[NSDate timeIntervalSinceReferenceDate]-runtime;<br />&gt;&nbsp; &nbsp; &nbsp;if(mFileDownloaded || timeout&lt;0.0)<br />&gt;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;break; &nbsp; &nbsp;<br />&gt; }<br />&gt; STAssertTrue(mFileDownloaded==YES,@"File failed to download");<br />&gt;<br />&gt; Cheers,<br />&gt; M<br />&gt;</span>]]></description>
            <author>Jamie Hardt</author>
            <category>Cocoa</category>
            <pubDate>Sat, 04 Jul 2009 19:31:10 +0100</pubDate>
            <guid>http://www.cocoabuilder.com/archive/message/cocoa/2009/7/4/240301</guid>
        </item>
        <item>
            <title>Unit Testing and Run Loops</title>
            <link>http://www.cocoabuilder.com/archive/message/cocoa/2009/7/4/240300</link>
            <description><![CDATA[Hello all,<br /><br />I've looked around for writing about this, but I can't really find&nbsp; <br />anybody who has declared the absolutely right solution to this problem.<br /><br />I'm using the SenTesting kit and writing a class that initiates a web&nbsp; <br />download, async using the run loop.&nbsp; How can I write a unit test that&nbsp; <br />makes sure that the class completes the download?&nbsp; The test case will&nbsp; <br />only run once, and threads in the unit test tool don't appear to have&nbsp; <br />run loops, or if they do, they don't appear to iterate.&nbsp; I've walked&nbsp; <br />friends through this problem before, and the best solution we came up&nbsp; <br />with is to rewrite all our code as synchronous but inside and&nbsp; <br />NSOperation, and then we unit test the operations to make sure they&nbsp; <br />work, and in the app we run the operations through an operation queue.<br /><br />But does anyone know how to setup something like a stream read or URL&nbsp; <br />download, and make sure run loop completely services the download/ <br />stream, and then write a unit test that makes sure all this happens?<br /><br />Jamie]]></description>
            <author>Jamie Hardt</author>
            <category>Cocoa</category>
            <pubDate>Sat, 04 Jul 2009 19:10:23 +0100</pubDate>
            <guid>http://www.cocoabuilder.com/archive/message/cocoa/2009/7/4/240300</guid>
        </item>
        <item>
            <title>leaking UIColor objects (correction)</title>
            <link>http://www.cocoabuilder.com/archive/message/cocoa/2009/7/4/240289</link>
            <description><![CDATA[Actually, Leaks reports that my app is leaking UICGColor objects, not&nbsp; <br />UIColor objects.]]></description>
            <author>WT</author>
            <category>Cocoa</category>
            <pubDate>Sat, 04 Jul 2009 13:35:31 +0100</pubDate>
            <guid>http://www.cocoabuilder.com/archive/message/cocoa/2009/7/4/240289</guid>
        </item>
        <item>
            <title>leaking UIColor objects</title>
            <link>http://www.cocoabuilder.com/archive/message/cocoa/2009/7/4/240288</link>
            <description><![CDATA[Hello all,<br /><br />my iPhone OS 3.0 app uses UIColor objects to set the colors of various&nbsp; <br />objects (text colors of labels, cell view backgrounds, and segmented&nbsp; <br />control tint colors), but I *never* store any of these colors as&nbsp; <br />ivars. In other words, I *only* do things like<br /><br />label.textColor = [UIColor blueColor];<br /><br />Now, after I installed 3.1 beta, **but still building under 3.0**,&nbsp; <br />Instruments/Leaks tells me that my app is leaking UIColor objects. My&nbsp; <br />app was leak-free under 3.0 Leaks.<br /><br />My conclusion is that Instruments (or, at least, Leaks) has changed&nbsp; <br />from 3.0 to 3.1 beta. I'm planning to report this as a bug, but I&nbsp; <br />thought I'd ask the community first, to make sure that this isn't&nbsp; <br />something I'm overlooking in my own code or elsewhere.<br /><br />And, yes, I realize that discussing beta releases is a no-no. I'm not&nbsp; <br />asking for a discussion; I'm merely asking for a "I'm having that&nbsp; <br />problem too and I've already filed a radar" or "Yes, this looks like a&nbsp; <br />bug and you should report it" or a "No, it must be something in your&nbsp; <br />code" kind of response.<br /><br />Thanks in advance.<br />Wagner]]></description>
            <author>WT</author>
            <category>Cocoa</category>
            <pubDate>Sat, 04 Jul 2009 13:27:32 +0100</pubDate>
            <guid>http://www.cocoabuilder.com/archive/message/cocoa/2009/7/4/240288</guid>
        </item>
        <item>
            <title>NSLinkAttributeName: can I control the visual presentation?</title>
            <link>http://www.cocoabuilder.com/archive/message/cocoa/2009/7/4/240287</link>
            <description><![CDATA[I have a mutable attributed string that is displayed in an NSTextView.&nbsp; <br />For a certain range, I set several attributes, including&nbsp; <br />NSLinkAttributeName. However, the presentation shows as blue&nbsp; <br />underlined text even though I have set other attributes for the font&nbsp; <br />color and also have set the underline style to none. Is there&nbsp; <br />something else I must do to control the visual presentation?&nbsp; Or am I&nbsp; <br />going to need to use tracking areas and manage this with dynamic&nbsp; <br />changes?]]></description>
            <author>Stuart Malin</author>
            <category>Cocoa</category>
            <pubDate>Sat, 04 Jul 2009 13:18:31 +0100</pubDate>
            <guid>http://www.cocoabuilder.com/archive/message/cocoa/2009/7/4/240287</guid>
        </item>
        <item>
            <title>NSData. add 6 bytes to NSData</title>
            <link>http://www.cocoabuilder.com/archive/message/cocoa/2009/7/4/240284</link>
            <description><![CDATA[Hi, everybody, I need to add 6 bytes to my NSData<br /><br />steps:<br /><br />1. write into NSData<br /><br />NSData *data = [NSData dataWithBytes:(const char*)&amp;packet length:sizeof(packet)];<br /><br />2. read from NSData<br />3. In loop i need to add 6 bytes<br />4. And again wtite into NSData<br /><br />first step i did, and from 2 to 4 i dont know how to do. Anybody could help me? Thanks in advance!]]></description>
            <author>Carlo Gulliani</author>
            <category>Cocoa</category>
            <pubDate>Sat, 04 Jul 2009 11:47:31 +0100</pubDate>
            <guid>http://www.cocoabuilder.com/archive/message/cocoa/2009/7/4/240284</guid>
        </item>
        <item>
            <title>looks like my syntax is wrong. Does not compile</title>
            <link>http://www.cocoabuilder.com/archive/message/cocoa/2009/7/4/240278</link>
            <description><![CDATA[Aobject is type of Myobject*<br /><br />it has an array for 6 intergers<br /><br />Aobject.myArray = [NSArray arrayWithObjects:[NSNumber numberWithInt: <br />1], [NSNumber numberWithInt: 2],[NSNumber numberWithInt:3], [NSNumber&nbsp; <br />numberWithInt:4], [NSNumber numberWithInt:5],[NSNumber numberWithInt: <br />6], nil];<br /><br />Now I would like to randomize it.<br /><br />for (int j = 0; j &lt; 6; j++)<br />{<br /> &nbsp; &nbsp;NSNumber* aNumber = [Aobject _Edge] numberWithInt:j;<br />&nbsp; &nbsp;  // looks like my syntax is wrong. Does not compile<br /><br />}]]></description>
            <author>Agha Khan</author>
            <category>Cocoa</category>
            <pubDate>Sat, 04 Jul 2009 04:29:51 +0100</pubDate>
            <guid>http://www.cocoabuilder.com/archive/message/cocoa/2009/7/4/240278</guid>
        </item>
        <item>
            <title>NSString stringWithFormat: and strings</title>
            <link>http://www.cocoabuilder.com/archive/message/cocoa/2009/7/4/240273</link>
            <description><![CDATA[Hello,<br />I have a NSString (from a property list file) that has the %@ formats in<br />it... So.. I do something like this:<br /><br />NSString *stringFromPlistFile;<br />NSString *newString = [NSString stringWithFormat:stringFromPlistFile,<br />@"Hello"];<br /><br />But that doesn't work...<br /><br />Keita]]></description>
            <author>KK</author>
            <category>Cocoa</category>
            <pubDate>Sat, 04 Jul 2009 03:20:17 +0100</pubDate>
            <guid>http://www.cocoabuilder.com/archive/message/cocoa/2009/7/4/240273</guid>
        </item>
        <item>
            <title>Send files from iphone</title>
            <link>http://www.cocoabuilder.com/archive/message/cocoa/2009/7/4/240269</link>
            <description><![CDATA[I need to be able to upload the data from a UIImage to a server via&nbsp; <br />http POST however I simply cannot find a good example of how to&nbsp; <br />arrange the headers or how to make this post.<br />The only data I need to send to the server is the file's name, the&nbsp; <br />user's name and the data itself and I simply cannot seem to get it to&nbsp; <br />work. Can any of you offer a helping hand?]]></description>
            <author>Development</author>
            <category>Cocoa</category>
            <pubDate>Sat, 04 Jul 2009 02:20:45 +0100</pubDate>
            <guid>http://www.cocoabuilder.com/archive/message/cocoa/2009/7/4/240269</guid>
        </item>
        <item>
            <title>Font matching</title>
            <link>http://www.cocoabuilder.com/archive/message/cocoa/2009/7/4/240267</link>
            <description><![CDATA[Hi, I have an application where I need to be able to find the closest&nbsp; <br />equivalent font should a font be missing. e.g. someone creates a file&nbsp; <br />and sends it to someone else, who doesn't have the font that was used&nbsp; <br />to create the original file installed on their system.<br /><br />I thought that maybe saving the NSFontDescriptor in the file should be&nbsp; <br />able to allow me to find the best font using the&nbsp; <br />matchingFontDescriptorsWithMandatoryKeys method passing nil as the&nbsp; <br />mandatory keys, but I have no idea what it would do if the font was&nbsp; <br />either there or missing:<br />- if the font was there, would it return just one font descriptor, or&nbsp; <br />potentially multiple?<br />- if it was able to be exactly matched, is there some way of knowing&nbsp; <br />this (e.g. is isEqual: implemented on NSFontDescriptor?)<br />- if the font is not there, will it continue to fall back until it&nbsp; <br />finds a suitable font? If so, will it return only one item in the&nbsp; <br />array? What does it try to match in the algorithm?<br />- if it does return multiple descriptors, are they ordered so that I&nbsp; <br />know which one is considered the best match?<br />- if I pass in nil as the mandatory keys, will it *always* return at&nbsp; <br />least one descriptor?<br /><br />Now sometimes my file is edited by someone using windoze, and the font&nbsp; <br />name doesn't exactly match what you see on the Mac even though it is&nbsp; <br />essentially the same font and usually the name of one is a substring&nbsp; <br />of the other. Is there an elegant way to handle this?<br /><br />Thanks<br /><br />Gideon]]></description>
            <author>Gideon King</author>
            <category>Cocoa</category>
            <pubDate>Sat, 04 Jul 2009 00:13:33 +0100</pubDate>
            <guid>http://www.cocoabuilder.com/archive/message/cocoa/2009/7/4/240267</guid>
        </item>
    </channel>
</rss>
