Facing trouble with the return of UIApplicationMain - xcode

I have a error help me please
2013-02-21 18:43:54.471 BPApp[12574:c07]
*** Assertion failure in -[MainViewController saveEntry:], /Users/Apple/Desktop/BPApp/BPApp/MainViewController.m:66
2013-02-21 18:43:54.473 BPApp[12574:c07] ***
Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: 'Could not update table'
*** First throw call stack:
(0x2091012 0x119ee7e 0x2090e78 0xc34f35 0x313d 0x11b2705 0xe9920 0xe98b8 0x1aa671 0x1aabcf 0x1a9d38 0x11933f 0x119552 0xf73aa 0xe8cf8 0x1fecdf9 0x1fecad0 0x2006bf5 0x2006962 0x2037bb6 0x2036f44 0x2036e1b 0x1feb7e3 0x1feb668 0xe665c 0x263d 0x2565)
libc++abi.dylib: terminate called throwing an exception.
(IBAction)saveEntry:(id)sender
{
int systolic = [systolicText.text intValue];
int diastolic = [diastolicText.text intValue];
NSString *comments = commentsText.text;
NSDate *theDate = [NSDate date];
NSString *sql = [NSString stringWithFormat:#"INSERT INTO summary('theDate', 'systolic', 'diastolic', 'comments') VALUES ('%#', '%d', '%d', '%#')", theDate, systolic, diastolic, comments];
char *err;
if (sqlite3_exec(db, [sql UTF8String], NULL, NULL, &err) !=SQLITE_OK) {
sqlite3_close(db);
NSAssert(0, #"Could not update table");
}else{
NSLog(#"table updated");
}
systolicText.text =#"";
diastolicText.text =#"";
commentsText.text =#"";
}
is mymainviewcontroller.m

As your error saying , go to the function saveEntry in the MainViewController and put the break point at the starting line of the saveEntry function , compile the code line by line . Then you can get the error at which line you are getting .

The issue is your use of NSAssert() which should only be used to detect and reject silly developer mistakes (that we are constantly making).
You should not use NSAssert() for failures that can occur at runtime, and any database interaction can fail.
Instead you should put that code into a method that returns BOOL and return NO if the insert fails. You should also log the reason for the failure, which you can get from sqlite3 using the function sqlite3_errmsg() (reference).
After that you need to handle the error by doing anything appropriate to your application; perhaps displaying an alert view and then closing the app, or retrying with different values or, well, anything you can think of to resolve the issue with the least discomfort to the user.

Related

ld verification of load/store fails when using LTO but not much info is provided

After updating to Xcode 10 our C++ codebase does not link when built with -Os and -flto. The following error is provided:
ld: Explicit load/store type does not match pointee type of pointer operand (Producer: 'APPLE_1_1000.11.45.2_0' Reader: 'LLVM APPLE_1_1000.11.45.2_0') for architecture x86_64
(the same error occurs on the latest Xcode 10.1 Beta 3)
The same code builds fine with Xcode 9. Sadly the linker does not provide any more info than spitting out the above error message. Some info about the object file would be helpful in trying to pinpoint the exact source of the problem. Removing -flto eliminates the error…
Does anyone have any debugging suggestions/ideas? We've tried to use "--trace" with ld to get more info on the files being processed but the error message just gets outputted in the middle of the trace with no apparent correlation between the error and the input file being printed at that moment.
This all smells very much of a compiler error and I've reported this to Apple via the bug tracker.
Any extra help would be greatly appreciated. Thanks
In my case turning any optimization -O1,2,3 spit out this error (while -flto was off)
I tracked it to the following issue.
I made a class Algo_three - so that I can return 3 values from a function:
#interface Algo_three<T,V,W> : NSObject{
#public
T p_0;
V p_1;
W p_2;
}
+ (Algo_three<T,V,W>*) first:(T) f second:(V) s third:(W) t;
#end
And I used it as follows (in .m file)
+(Algo_three<NSManagedObjectContext*,NSManagedObjectContext*,NSError*>*) CreateCDContexts: ....
{
return [Algo_three first:ui_managedObjectContext second:sync_managedObjectContext third:nil];
}
Receiving 3 values - this was good as well..
Algo_three<NSManagedObjectContext*,NSManagedObjectContext*,NSError*> * two_contexts = [not_important_class CreateCDContexts: ... ];
//and here is accessing
self->ui_context = (NSManagedObjectContext*) two_contexts->p_0; //getting 1st value
self->sync_context = (NSManagedObjectContext*) two_contexts->p_1; //2nd value
Commenting out last two lines removed the error!
So I added three accessor properties to class Algo_three and it worked.
Algo_three class lookes like this (.h).
#interface Algo_three<T,V,W> : NSObject{
#public
T p_0;
V p_1;
W p_2;
}
#property (strong,nonatomic) T first;
#property (strong,nonatomic) V second;
#property (strong,nonatomic) W third;
+ (Algo_three<T,V,W>*) first:(T) f second:(V) s third:(W) t;
#end
Implementation of those properties (.m):
- (id) first{
return p_0;
}
-(void) setFirst:(id) obj{
self->p_0 = obj;
}
- (id) second{
return p_1;
}
-(void) setSecond:(id) obj{
self->p_1 = obj;
}
- (id) third{
return p_2;
}
-(void) setThird:(id) obj{
self->p_2 = obj;
}
and instead of ->p_0 accessing is done via properties .first, .second
self->ui_context = (NSManagedObjectContext*) two_contexts.first;
self->sync_context = (NSManagedObjectContext*) two_contexts.second;
Lastly I admit - that compiler told me what file the error was located in, albeit not so clearly.
XCode 10.1 (10B61). I scrutinised the file that was just before the compiler error - I confirmed it by running archive from command line :
xcodebuild -scheme MY_PROJ archive

DBD::Oracle::st execute failed: system generated message

For oracle system generated Software Error messages during prepare/execute query invalid. displays complete query to user on a webpage. want to replace system generated message with user common message.
example:
Software error:
DBD::Oracle::st execute failed: ORA-01722: invalid number (DBD ERROR: error possibly near <> indicator at char 136 in 'SELECT EQUIPID, EQUIPSHORTNAME, MAXLIMITEDDAYS, STATUS, EQUIPNAME FROM LAB_EQUIPMENT_DETAILS WHERE CATEGORYID = '3' AND SUBCATEGORYID = <>' ' AND STATUS != 'DELETE'') [for Statement "SELECT EQUIPID, EQUIPSHORTNAME, MAXLIMITEDDAYS, STATUS, EQUIPNAME FROM LAB_EQUIPMENT_DETAILS WHERE CATEGORYID = '3' AND SUBCATEGORYID = '****' AND STATUS != 'DELETE'"] at /proj/aa/bb/Source/Global_Routines_general_apps.pm line 126.
For help, please send mail to the webmaster ([...]), giving this error message and the time and date of the error.
Can anyone please help me in doing this.
Thanks in advance.
Simply wrap your execute statement in an eval block and catch the error.
eval {
$sth->execute();
...
};
if ( $# ) {
# log the full error message
write_log( $sth->errstr );
# and re-throw the common message
die 'HEY!!!! Something is messed up here!';
}

Xcode 4.6 if statement with &&

My problem is
-(IBAction)setAction:(id)sender{
if ([labelOne.text isEqual: #"One"] && [labelTwo.text isEqual: #"Two"]) {
labelShow.text = #"Yes it works :)";
}
}
And if i build it. It show me the error code: Thread 1: signal SIGBART
but it works if i do it like this
-(IBAction)setAction:(id)sender{
if ([labelOne.text isEqual: #"One"]) {
labelShow.text = #"Yes it works :)";
}
}
What can I do, that the First one works?:)
The SIBABRT implies that either labelTwo or labelTwo.text is pointing to bad memory.
First figure out which pointer is bad, and then debug to see why. Also, provide a crash log when possible. There should be an error message associated in your debug output pane.
Check out this debugging tutorial.

how to interpret the error codes of boost::mpi?

How to make sense of the boost::mpi error code? For instance, what does error code 834983239 mean?
...
mpi::communicator world;
mpi::request req = world.isend(1, 1, std::string("hello"));
while(!req.test()) {
boost::this_thread::sleep(boost::posix_time::seconds(1));
}
int errorCode = req.test()->error();
...
The error code is unlikely to be filled in if there was not an error (and the default behavior for Boost.MPI is to throw an exception on error, not return a code). You should not need to check error codes manually unless you have changed Boost.MPI's default error handling settings.

Failed to communicate with qtkitserver: Connection invalid

In Mountain Lion (Fresh installation and not upgrade from 10.6 or 10.7), Im facing the issue while m trying to create a QTMovie, with the following exception:
2012-08-17 15:34:49.434 DemoApp[15995:303] Failed to communicate with qtkitserver:
Connection invalid
2012-08-17 15:34:49.434 DemoApp [15995:303] Failed to initializeServer(), returned 5
2012-08-17 15:34:55.614 DemoApp [15995:303] Error - Error Domain=NSOSStatusErrorDomain Code=-2012
"The movie contains an invalid data reference." (invalidDataRef)
UserInfo=0x108ae9ca0 {NSLocalizedDescription=The movie contains an invalid data reference.}
My code is as follows:
NSError *error = nil;
movie = [QTMovie movieWithURL:mediaURL error:&error];
NSLog(#"Error - %#", error);
But the 'movie' object is nil. Can anyone help me on this.
Thanks in advance,

Resources