Error 'Missing' ['at start of message send expression "

0

Good evening everyone, I'm integrating the Moip SDK (a payment gateway) but my knowledge is more in swift (I started the studies a few months ago).

They make sdk available for encryption of sensitive credit card data, however I'm getting a seemingly simple error but I do not know how to solve it, as if it were missing a square bracket in the line of code.

#import "MoipCrypt.h"
#import <MoipSDK/MoipSDK.h>

@implementation MoipCrypt

NSString *myPublicKey = @"-----BEGIN PUBLIC KEY-----CHAVE PUBLICA-----END PUBLIC KEY-----";
[MoipSDK importPublicKey:myPublicKey];

@end

The error is in the line

[MoipSDK importPublicKey:myPublicKey];

Where the following messages appear:

Expected ']' Expected identifier or '(' Missing '[' at start of message send expression

Even the solution given by xcode ("Insert ';'") only causes other syntax errors.

The sdk github link is as follows:

Moip Encryption sdk-ios

Thank you all for the help.

    
asked by anonymous 17.07.2018 / 03:48

1 answer

0

This is because you are not declaring this within a method, so it is only like code dropped inside a file

try this:


#import "MoipCrypt.h"
#import 

@implementation MoipCrypt

-(void) anyFunction{

    NSString *myPublicKey = @"-----BEGIN PUBLIC KEY-----CHAVE PUBLICA-----END PUBLIC KEY-----";
    [MoipSDK importPublicKey:myPublicKey];
}

@end

    
31.07.2018 / 18:35