Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Parse and Xcode: Blocks won't autocomplete.

The last version of Parse (1.7.1) and Xcode (6.3) I can't autocomplete blocks for parse API. This is really annoying. Does anyone else have this problem?

Before, like every other blocks, you can tab to highlight it, and then hit enter.

     [query findObjectsInBackgroundWithBlock:^(NSArray *objects, NSError *error)
     {

     }];

Now when I hit enter, this happens:

[query findObjectsInBackgroundWithBlock:(nullable PFArrayResultBlock(nullable )block
like image 302
BlackMouse Avatar asked Apr 16 '15 08:04

BlackMouse


1 Answers

With the new update parse took away the ability to enter and complete the block. I think that is just not good. But here is the workaround. These blocks are defined in PFConstants.h like this

typedef void (^PFBooleanResultBlock)(BOOL succeeded, NSError *PF_NULLABLE_S error);
typedef void (^PFIntegerResultBlock)(int number, NSError *PF_NULLABLE_S error);
typedef void (^PFArrayResultBlock)(NSArray *PF_NULLABLE_S objects, NSError *PF_NULLABLE_S error);
typedef void (^PFObjectResultBlock)(PFObject *PF_NULLABLE_S object,  NSError *PF_NULLABLE_S error);
typedef void (^PFSetResultBlock)(NSSet *PF_NULLABLE_S channels, NSError *PF_NULLABLE_S error);
typedef void (^PFUserResultBlock)(PFUser *PF_NULLABLE_S user, NSError *PF_NULLABLE_S error);
typedef void (^PFDataResultBlock)(NSData *PF_NULLABLE_S data, NSError *PF_NULLABLE_S error);
typedef void (^PFDataStreamResultBlock)(NSInputStream *PF_NULLABLE_S stream, NSError *PF_NULLABLE_S error);
typedef void (^PFStringResultBlock)(NSString *PF_NULLABLE_S string, NSError *PF_NULLABLE_S error);
typedef void (^PFIdResultBlock)(PF_NULLABLE_S id object, NSError *PF_NULLABLE_S error);
typedef void (^PFProgressBlock)(int percentDone);

So your code would be

[query findObjectsInBackgroundWithBlock:^(NSArray *PF_NULLABLE_S objects, NSError *PF_NULLABLE_S error)

Here, ^(NSArray *PF_NULLABLE_S objects, NSError *PF_NULLABLE_S error) is the PFArrayResultBlock.

To make things quicker you can control click on PFUserResultBlock to find the definition and copy.

like image 125
Subash Avatar answered Oct 10 '22 01:10

Subash