Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<blockquote> <p>For example, this like produces an error (not in Debug mode):</p> <pre><code>CGRect rect = [someObject window]frame]; </code></pre> </blockquote> <p>Well, that's because that's invalid code. You're missing a <code>[</code>.</p> <p>More to the point:</p> <blockquote> <pre><code>passing 'NSRect' (aka 'struct _NSRect') to parameter of incompatible type 'CGRect' (aka 'struct CGRect') </code></pre> <p>It is true, i'm using NSRect as CGRect and vice versa but i don't get these errors in Debug mode.</p> </blockquote> <p>By default, the Debug configuration builds only the active architecture, which is the architecture of the current run destination (the right half of the Scheme pop-up, assuming you're using Xcode 4). If it's set to “My Mac 64-bit”, that would be why it's always worked.</p> <p>Try this: Change the run destination to “My Mac <em>32</em>-bit”, then try to Run.</p> <p>See?</p> <p>In 64-bit Mac OS X, <code>NSRect</code> is defined as <code>CGRect</code>, which is how you're able to freely convert between them. In 32-bit Mac OS X, <code>NSRect</code> is defined separately, so you can't just cast from one value type to the other. They're defined the same, so you can do pointer-aliasing or go through a union and it will work, but you can't just cast, implicitly or explicitly, because they are separate, unrelated definitions.</p> <p>There are two solutions:</p> <ul> <li>Drop support for 32-bit from your app. Set your Architectures in all configurations to “Standard Intel 64-bit”.</li> <li>In your prefix header or in the Preprocessor Macros build setting, define the <code>NS_BUILD_32_LIKE_64</code> macro to <code>1</code>. When this is defined to a true value, <code>NSRect</code> will be defined as <code>CGRect</code> (and likewise the other geometry types), even on 32-bit.</li> </ul>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload