message/count_broadcast is not working?
  • HI,
       I  am using  ASIFormDataRequest for sending REST API  message/count_broadcast   through your sample iphone sdk after loggin in succesfully
    though LQSESSION's  requestSessionWithUsername.(I could not add parameters in runApiRequest Method )but the error first comes like "No User was specified in the Request,and anonymous access to this method is not allowed".After giving user name as parameter,error comes like "No user was specified in the request, and anonymous access to this method is not allowed." THe code i use is as follows(I have given my user_id,layer_id which is in my account:

        NSURL *url = [self urlWithPath:@"message/count_broadcast"];

        __block ASIFormDataRequest *request = (ASIFormDataRequest *)[self appRequestWithURL:url class:@"ASIFormDataRequest"];


        


        [self addDeviceInfoToRequest:request];


        [request setPostValue:@"BnM" forKey:@"layer_id"];


        [request setPostValue:@"6F3" forKey:@"user_id"];


        [request setPostValue:@"_dJZq21hdx2c4UZHT4" forKey:@"username"];


        [request setPostValue:@"12.935635" forKey:@"latitude"];


        [request setPostValue:@"80.110893" forKey:@"longitude"];


        [request setPostValue:@"400" forKey:@"radius"];


        [request setPostValue:@"Hi " forKey:@"text"];


    //addDeviceInfoToRequest method


    - (void)addDeviceInfoToRequest:(ASIFormDataRequest *)request {


    UIDevice *d = [UIDevice currentDevice];


    [request setPostValue:[NSString stringWithFormat:@"%@ %@", d.systemName, d.systemVersion] forKey:@"platform"];


    [request setPostValue:[self hardware] forKey:@"hardware"];


    [request setPostValue:[LQClient UUIDString] forKey:@"device_id"];


        [request setPostValue:[self macAddress] forKey:@"mac"];


    }


       


  • 2 Comments sorted by
  • It sounds like no access token is being included in the request. Make sure you are saving the session after running `requestSessionWithUsername`.

    This may look something like this:









    [LQSession requestSessionWithUsername:self.emailAddressField.text     password:self.passwordField.text completion:^(LQSession *session, NSError *error){


          if(session.accessToken) {
              NSLog(@"Logged in successfully! %@", session.accessToken);
              [LQSession setSavedSession:session];


          } else {
              // Failed login
              NSLog(@"Error logging in %@", error);
          }
    }];


  • Also can you paste a link to the Github project you're using as a base example?

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

In this Discussion