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
-(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)
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.
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.