0

I am using Kumulos to submit information to a database. Unfortunately, I cannot get the submit method to work.

This app is written in Objective-C in Xcode

I have copied Kumulos.h, Kumulos.m, libKumulos.h and libKumulos_iOS_.0.7.4.a into my project.

in my viewDidLoad I have:

k = [[Kumulos alloc]init];
[k setDelegate:self];

and then I call the submit method in another thread by doing:

- (IBAction)submit:(UIButton *)sender 
{   
    [loader startAnimating];
    [NSThread detachNewThreadSelector:@selector(SubmittoDB) toTarget:self withObject:nil];
}

Which calls this method in another thread:

-(void)SubmittoDB
{

    NSDate *date=[NSDate date];

    Transporter *T = [Transporter shared];

    [k submitToDbWithLatitude:[T getlat]
                 andLongitude:[T getlon]
                 andFirstName:[T getfirstname]
                  andLastName:[T getlastname]
              andEmailAddress:[T getemail]
               andPhoneNumber:[T getphone]
              andDateReported:date
                andPoleNumber:@"NULL"
                     andOther:othertext.text
                   andProblem:[T getproblem]];
}

The T object is just an object that was holding the information.

These are my didCompleteWithResult and didFailWithError methods:

-(void) kumulosAPI:(Kumulos *)kumulos apiOperation:(KSAPIOperation *)operation submitToDbDidCompleteWithResult:(NSNumber *)newRecordID
{
    [self performSelectorOnMainThread:@selector(segue) withObject:nil waitUntilDone:false];
}


-(void) kumulosAPI:(kumulosProxy *)kumulos apiOperation:(KSAPIOperation *)operation didFailWithError:(NSString *)theError
{
     errormessage=theError;
     [self performSelectorOnMainThread:@selector(error) withObject:nil waitUntilDone:false];
}//failwitherror

UPDATE

-(void)segue
{
    [loader stopAnimating];
    [self performSegueWithIdentifier:@"uploaderdebrief" sender:self];
    }//segue

-(void)error
{
    [loader stopAnimating];
    UIAlertView *nope = [[UIAlertView alloc]initWithTitle:@"Error" 
                                                  message:errormessage
                                                 delegate:nil 
                                        cancelButtonTitle:@"OK" 
                                        otherButtonTitles:nil];
    [nope show];
}

The failure method executes every single time, but the NSString "theError" is always nil so I have no idea what is going wrong. If I run this API method from the kumulos dashboard on the Kumulos website, I can submit data to the database successfully.

Does anybody have any idea what might be happening? Any help will be appreciated. Also hope everybody had a good Christmas (if that is your thing)


EDIT

I placed a breakmark a little sooner, and I found that the NSString theError says Variable is not a CFString and then if I take another step it reverts back to nil. Is there any way to find out which variable that it is referring to? Also, why does theError change back to nil? I would like to be able to print out that error message.

Michael Dautermann
  • 88,797
  • 17
  • 166
  • 215
0nyx
  • 144
  • 2
  • 12
  • what is "`errormessage`" declared as? what does the code for your "`error`" method look like? – Michael Dautermann Dec 26 '12 at 20:15
  • Updated with code for "segue" and "error" methods. "errormessage" is a global variable of type NSString – 0nyx Dec 26 '12 at 20:24
  • Are you still seeing this issue? If so, could you file a support case in Kumulos and we'll take it from there. – cgwyllie Jan 02 '13 at 09:25
  • I am not, it ended up being an issue with the network i was on. This error happened when i failed the NTLM authentication. If I am connected to the network, or if I am not connected (wifi disabled and ethernet unplugged), it works. It's only when wifi is enabled and the NTLM fails does the issue occur. – 0nyx Jan 02 '13 at 16:13

2 Answers2

0

I seem to be having a similar situation, except nothing is returned for me, not even to the didFailWithError delegate method. I've added some logging in the kumulos.m file. This may help you, but it hasn't led me anywhere yet. Look for your submitToDbWithLatitude method in your kumulos.m file and add [newOp setDebugMode:YES]; after the KSAPIOperation is initialized.

When you Run the project it will provide some more verbose results. Might help. Mike

Mike Davis
  • 11
  • 3
  • Well I came back this morning, and it worked. I don't know if it had something to do with Kumulos' servers or if restarting Xcode did something. But I didn't change anything and now it works. – 0nyx Dec 27 '12 at 14:36
  • Actually, I can confirm that that the culprit was the wireless network I was working on. When I simulated having no internet by disabling everything I did not realize I had to re-enter my information when joining the network again. The app behaves as desired when correctly connected to the network. – 0nyx Dec 27 '12 at 15:44
0

It ended up being an issue with the network I was on. The error happened because in order to simulate the device not having internet, I would simply disable wifi, and upon re-enabling wifi I did not resupply the username/password to pass the NTLM authentication.

0nyx
  • 144
  • 2
  • 12