<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
		>
<channel>
	<title>Comments on: Creating a NSManagedObject that is Cross Platform</title>
	<atom:link href="http://www.cimgf.com/2010/02/18/creating-a-nsmanagedobject-that-is-cross-platform/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.cimgf.com/2010/02/18/creating-a-nsmanagedobject-that-is-cross-platform/</link>
	<description>Taglines are for Windows programmers</description>
	<lastBuildDate>Sat, 04 Sep 2010 17:42:21 +0000</lastBuildDate>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0.1</generator>
	<item>
		<title>By: paqman</title>
		<link>http://www.cimgf.com/2010/02/18/creating-a-nsmanagedobject-that-is-cross-platform/comment-page-1/#comment-1332</link>
		<dc:creator>paqman</dc:creator>
		<pubDate>Thu, 15 Apr 2010 16:08:11 +0000</pubDate>
		<guid isPermaLink="false">http://www.cimgf.com/?p=950#comment-1332</guid>
		<description>&lt;p&gt;Hi,&lt;/p&gt;

&lt;p&gt;I am new to iphone development and thought that your code might help me but I am having difficulty using it.&lt;/p&gt;

&lt;p&gt;Background: I am using imagePickerController to select an image which I then pass to my bilinear scale routine, create a new UIImage. This Image is used as my background in a UIView which the user can draw lines on. As such I redraw the Image every time the user draws a line. The problem I am having is that the UImage that I create does not retain the data and crashes the program.&lt;/p&gt;

&lt;p&gt;So I thought your code would fit into my project perfectly but I am not sure
what I am supposed to put in for myManagedObject, xcode is telling that it is undeclared.&lt;/p&gt;

&lt;p&gt;Any help would be appreciated.
Thanks John&lt;/p&gt;
</description>
		<content:encoded><![CDATA[<p>Hi,</p>

<p>I am new to iphone development and thought that your code might help me but I am having difficulty using it.</p>

<p>Background: I am using imagePickerController to select an image which I then pass to my bilinear scale routine, create a new UIImage. This Image is used as my background in a UIView which the user can draw lines on. As such I redraw the Image every time the user draws a line. The problem I am having is that the UImage that I create does not retain the data and crashes the program.</p>

<p>So I thought your code would fit into my project perfectly but I am not sure
what I am supposed to put in for myManagedObject, xcode is telling that it is undeclared.</p>

<p>Any help would be appreciated.
Thanks John</p>]]></content:encoded>
	</item>
	<item>
		<title>By: booleanman</title>
		<link>http://www.cimgf.com/2010/02/18/creating-a-nsmanagedobject-that-is-cross-platform/comment-page-1/#comment-1299</link>
		<dc:creator>booleanman</dc:creator>
		<pubDate>Fri, 12 Mar 2010 03:21:12 +0000</pubDate>
		<guid isPermaLink="false">http://www.cimgf.com/?p=950#comment-1299</guid>
		<description>&lt;p&gt;For some good examples of how to write libraries that work on either OS X or iPhone OS, check out the Google Toolbox for Mac:&lt;/p&gt;

&lt;p&gt;http://code.google.com/p/google-toolbox-for-mac/&lt;/p&gt;

&lt;p&gt;They have a lot of sample code that will compile for either platform.&lt;/p&gt;
</description>
		<content:encoded><![CDATA[<p>For some good examples of how to write libraries that work on either OS X or iPhone OS, check out the Google Toolbox for Mac:</p>

<p><a href="http://code.google.com/p/google-toolbox-for-mac/" rel="nofollow">http://code.google.com/p/google-toolbox-for-mac/</a></p>

<p>They have a lot of sample code that will compile for either platform.</p>]]></content:encoded>
	</item>
	<item>
		<title>By: davbeck</title>
		<link>http://www.cimgf.com/2010/02/18/creating-a-nsmanagedobject-that-is-cross-platform/comment-page-1/#comment-1297</link>
		<dc:creator>davbeck</dc:creator>
		<pubDate>Wed, 10 Mar 2010 23:24:56 +0000</pubDate>
		<guid isPermaLink="false">http://www.cimgf.com/?p=950#comment-1297</guid>
		<description>&lt;p&gt;I find that using #if TARGET_OS_IPHONE works better. The trick is that you have to user #if instead of #ifdef.&lt;/p&gt;
</description>
		<content:encoded><![CDATA[<p>I find that using #if TARGET_OS_IPHONE works better. The trick is that you have to user #if instead of #ifdef.</p>]]></content:encoded>
	</item>
	<item>
		<title>By: Mo</title>
		<link>http://www.cimgf.com/2010/02/18/creating-a-nsmanagedobject-that-is-cross-platform/comment-page-1/#comment-1294</link>
		<dc:creator>Mo</dc:creator>
		<pubDate>Fri, 05 Mar 2010 17:05:22 +0000</pubDate>
		<guid isPermaLink="false">http://www.cimgf.com/?p=950#comment-1294</guid>
		<description>&lt;p&gt;Why don&#039;t you define a new type so you can unify the codes? Like...&lt;/p&gt;

&lt;p&gt;ifdef IPHONEOS_DEPLOYMENT_TARGET&lt;/p&gt;

&lt;p&gt;typedef UIImage MYImage;&lt;/p&gt;

&lt;p&gt;else&lt;/p&gt;

&lt;p&gt;typedef NSImage MYImage;&lt;/p&gt;

&lt;p&gt;NSData * UIImagePNGRepresentation(MYImage *image){
    NSBitmapImageRep *bits = [[image representations] objectAtIndex: 0];&lt;/p&gt;

&lt;p&gt;&lt;pre&gt;&lt;code&gt;return [bits representationUsingType:NSPNGFileType properties:nil];
&lt;/code&gt;&lt;/pre&gt;&lt;/p&gt;

&lt;p&gt;}&lt;/p&gt;

&lt;p&gt;endif&lt;/p&gt;

&lt;p&gt;@implementation MyEntityWithAnImage&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;(void)setImage:(MYImage*)image
{
[self willChangeValueForKey:@&quot;image&quot;];&lt;/p&gt;

&lt;p&gt;NSData *data = UIImagePNGRepresentation(image);&lt;/p&gt;

&lt;p&gt;[myManagedObject setImage:data];
[self setPrimitiveValue:data forKey:@&quot;image&quot;];
[self didChangeValueForKey:@&quot;image&quot;];
}&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;(MYImage*)image
{
[self willAccessValueForKey:@&quot;image&quot;];
MYImage *image = [[MYImage alloc] initWithData:[self primitiveValueForKey:@&quot;image&quot;]];
[self didAccessValueForKey:@&quot;image&quot;];
return image;
}&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;@end&lt;/p&gt;

&lt;p&gt;It&#039;s easier to manage the code this way.&lt;/p&gt;
</description>
		<content:encoded><![CDATA[<p>Why don&#8217;t you define a new type so you can unify the codes? Like&#8230;</p>

<p>ifdef IPHONEOS_DEPLOYMENT_TARGET</p>

<p>typedef UIImage MYImage;</p>

<p>else</p>

<p>typedef NSImage MYImage;</p>

<p>NSData * UIImagePNGRepresentation(MYImage *image){
    NSBitmapImageRep *bits = [[image representations] objectAtIndex: 0];</p>

<p><pre><code>return [bits representationUsingType:NSPNGFileType properties:nil];
</code></pre></p>

<p>}</p>

<p>endif</p>

<p>@implementation MyEntityWithAnImage</p>

<ul>
<li><p>(void)setImage:(MYImage*)image
{
[self willChangeValueForKey:@"image"];</p>

<p>NSData *data = UIImagePNGRepresentation(image);</p>

<p>[myManagedObject setImage:data];
[self setPrimitiveValue:data forKey:@"image"];
[self didChangeValueForKey:@"image"];
}</p></li>
<li><p>(MYImage*)image
{
[self willAccessValueForKey:@"image"];
MYImage *image = [[MYImage alloc] initWithData:[self primitiveValueForKey:@"image"]];
[self didAccessValueForKey:@"image"];
return image;
}</p></li>
</ul>

<p>@end</p>

<p>It&#8217;s easier to manage the code this way.</p>]]></content:encoded>
	</item>
	<item>
		<title>By: markaufflick</title>
		<link>http://www.cimgf.com/2010/02/18/creating-a-nsmanagedobject-that-is-cross-platform/comment-page-1/#comment-1276</link>
		<dc:creator>markaufflick</dc:creator>
		<pubDate>Fri, 19 Feb 2010 05:04:43 +0000</pubDate>
		<guid isPermaLink="false">http://www.cimgf.com/?p=950#comment-1276</guid>
		<description>&lt;p&gt;Oh, and see you next week!&lt;/p&gt;
</description>
		<content:encoded><![CDATA[<p>Oh, and see you next week!</p>]]></content:encoded>
	</item>
	<item>
		<title>By: markaufflick</title>
		<link>http://www.cimgf.com/2010/02/18/creating-a-nsmanagedobject-that-is-cross-platform/comment-page-1/#comment-1275</link>
		<dc:creator>markaufflick</dc:creator>
		<pubDate>Fri, 19 Feb 2010 05:04:25 +0000</pubDate>
		<guid isPermaLink="false">http://www.cimgf.com/?p=950#comment-1275</guid>
		<description>&lt;p&gt;You could also serialise a CGImage representation, which you can turn into a UIImage or NSImage.&lt;/p&gt;

&lt;p&gt;Having said that, I can&#039;t think of much benefit doing it that way and ironically I suspect you would have to write more code than using PNG.&lt;/p&gt;
</description>
		<content:encoded><![CDATA[<p>You could also serialise a CGImage representation, which you can turn into a UIImage or NSImage.</p>

<p>Having said that, I can&#8217;t think of much benefit doing it that way and ironically I suspect you would have to write more code than using PNG.</p>]]></content:encoded>
	</item>
	<item>
		<title>By: DavidM</title>
		<link>http://www.cimgf.com/2010/02/18/creating-a-nsmanagedobject-that-is-cross-platform/comment-page-1/#comment-1273</link>
		<dc:creator>DavidM</dc:creator>
		<pubDate>Fri, 19 Feb 2010 00:49:55 +0000</pubDate>
		<guid isPermaLink="false">http://www.cimgf.com/?p=950#comment-1273</guid>
		<description>&lt;p&gt;The target conditionals that you are looking for are in &lt;TargetConditionals.h&gt;.&lt;/p&gt;
</description>
		<content:encoded><![CDATA[<p>The target conditionals that you are looking for are in &lt;TargetConditionals.h&gt;.</p>]]></content:encoded>
	</item>
</channel>
</rss>
