Note that there are some explanatory texts on larger screens.

plurals
  1. POIncompatible block pointer types using typedef
    primarykey
    data
    text
    <p>For a day now I've been trying to get a piece of code working to help me handle find-and-create for CoreData in a nice way (from this article I found <a href="http://emplementation.blogspot.nl/2011/12/importing-data-into-core-data-while.html" rel="nofollow">http://emplementation.blogspot.nl/2011/12/importing-data-into-core-data-while.html</a>). I ended up working with code blocks which I've never done before. </p> <p>Somehow I can't fix the following error which occurs because something is different in my typedef from what I try to define in my function. I think I understand it has something to do with the block being defined as __strong in the typedef but differently in my implementation file.</p> <p>Error</p> <blockquote> <p>Incompatible block pointer types initializing '_<em>strong objectOperationBlock' (aka 'void (^</em>_strong)(NSManagedObjectContext *_<em>strong, NSDictionary *</em>_strong, NSManagedObject *_<em>strong)') with an expression of type 'void (^)(NSManagedObject *</em>_strong, NSDictionary *_<em>strong, NSManagedObject *</em>_strong)'</p> </blockquote> <p>MyViewController.h</p> <pre><code>typedef void (^objectOperationBlock)(NSManagedObjectContext *context, NSDictionary *hostObjectData, NSManagedObject *localManagedObject); </code></pre> <p>MyViewController.m</p> <pre><code>objectOperationBlock matchedBlock = ^(NSManagedObject *context, NSDictionary *hostObjectData, NSManagedObject *localManagedObject){ NSLog(@"Dosomething"); }; </code></pre> <p>In all my attempts I've found out that this could will build (but it's not using the typedef)</p> <pre><code>void (^matchedBlock)(NSManagedObject*, NSDictionary*, NSManagedObject*) = ^(NSManagedObject *context, NSDictionary *hostObjectData, NSManagedObject *localManagedObject){ NSLog(@"Dosomething"); }; </code></pre> <p>Thanks in advance for all your help!</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

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