Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p>You should be using <a href="http://developer.apple.com/documentation/Cocoa/Reference/Foundation/Classes/NSNotification_Class/Reference/Reference.html#//apple_ref/occ/clm/NSNotification/notificationWithName:object:userInfo:" rel="nofollow noreferrer">+notificationWithName:object:userInfo:</a> not <a href="http://developer.apple.com/documentation/Cocoa/Reference/Foundation/Classes/NSNotification_Class/Reference/Reference.html#//apple_ref/occ/clm/NSNotification/notificationWithName:object:" rel="nofollow noreferrer">+notificationWithName:object:</a>. </p> <p>The object parameter is the object sending the notification. Normally this would be self for an object posting the notification but since your calling this from a C function it should be nil.</p> <p>The userInfo parameter is an <code>NSDictionary</code> so add the <code>NSValue</code> to a dictionary and send that.</p> <p>Then in your selName: method get the <a href="http://developer.apple.com/documentation/Cocoa/Reference/Foundation/Classes/NSNotification_Class/Reference/Reference.html#//apple_ref/occ/instm/NSNotification/userInfo" rel="nofollow noreferrer">-userInfo</a> dict from the <a href="http://developer.apple.com/documentation/Cocoa/Reference/Foundation/Classes/NSNotification_Class/Reference/Reference.html" rel="nofollow noreferrer">NSNotification</a> and pull your info out from there.</p> <p>Note: You are creating a leak by retaining the <code>NSValue</code> when you shouldn't.</p> <p>Edit:</p> <p>How long does the struct exist? <code>NSValue</code> will not copy the contents of the pointer so maybe it's being deallocated? Try using <code>NSData</code>'s <a href="http://developer.apple.com/documentation/Cocoa/Reference/Foundation/Classes/NSData_Class/Reference/Reference.html#//apple_ref/occ/clm/NSData/dataWithBytes:length:" rel="nofollow noreferrer">dataWithBytes:length:</a> instead.</p> <p>Also make sure to check the console for runtime errors (in Xcode:<code>Run &gt; Console</code>).</p> <p>And you do not need to retain dict. You may want to (re)read the <a href="http://developer.apple.com/documentation/Cocoa/Conceptual/MemoryMgmt/MemoryMgmt.html" rel="nofollow noreferrer">Cocoa memory management</a> docs. </p>
 

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