如何修复错误“预期表达式”

时间:2018-10-12 05:05:19

标签: ios objective-c xcode

所以我当时在Xcode ( Objective C)上开发了一个应用程序,但我确实找不到解决该问题的方法

有人可以帮我吗?

    #import "ViewController.h"
    #import "DistanceGetter/DGDistanceRequest.h"

    @interface ViewController ()
    @property (weak, nonatomic) IBOutlet UITextField *startLocation;
    @property (nonatomic) DGDistanceRequest *req;
    @property (weak, nonatomic) IBOutlet UITextField *endLocationA;
    @property (strong, nonatomic) IBOutlet UIView *distanceA;

    @property (weak, nonatomic) IBOutlet UITextField *endLocationB;
    @property (weak, nonatomic) IBOutlet UILabel *distanceB;

    @property (weak, nonatomic) IBOutlet UITextField *endLocationC;
    @property (weak, nonatomic) IBOutlet UILabel *distanceC;

    @property (weak, nonatomic) IBOutlet UIButton *calculateButton;

    @end

    @implementation ViewController
    - (IBAction)calculateButtonTapped:(id)sender {
    self.calculateButton.enabled=NO;
    self.req = [DGDistanceRequest alloc];
    NSString *start = self.startLocation.text;
    NSString *destA = self.endLocationA.text;
    NSString *destB = self.endLocationA.text;
    NSString *destC = self.endLocationA.text;
    NSArray *dests = @[destA,destB,destC];


    self.req = [self.req initWithLocationDescriptions:dests 
    sourceDescription:start];
    self.req.callback= void(ˆNSArray *responses)
    self.distanceC.text=@"callback";
    self.calculateButton.enabled = YES;
    self.req=nil;

当我将其设置为void(NSArray .....)时,它会给出更多错误

1 个答案:

答案 0 :(得分:1)

您有错别字: void(^...应该为^void(...-错误在某种程度上具有误导性,而且似乎比Xcode没有建议“ Fix-it”更奇怪。

无论如何,我建议http://goshdarnblocksyntax.com/通过块语法来提醒自己。