SIGABRT error during interface change - xcode

(IBAction)switchAppointment {
AppointmentController *appt = [[AppointmentController alloc] initWithNibName:nil bundle:nil];
appt.modalTransitionStyle = UIModalTransitionStyleCrossDissolve;
[self presentModalViewController:appt animated:YES];
[appt release];
}
That is the code that I use to switch from one .xib to another, however on the line that says "self presentModalViewController:appt animated:YES" , I'm getting a SIGABRT error. My app crashes immediately when I try to go into that interface.
FYI too I'm on Xcode 4.2, but it was doing this before I downloaded the beta.

I have also same answer for the code:
nextView *second=[[nextView alloc] initWithNibName:nil bundle:nil];
[self presentModalViewController:second animated:YES];
[second release];
Yours
Miska

Related

MFMailComposeViewController not working iOS 9

I am using xcode 7.3 and using following code to open MfMailComposeViewController and object of mail composer goes nil after alloc init it.
- (void)openMailComposer {
NSString *emailTitle = #"Invite for SpotFit";
MFMailComposeViewController *mailVC = [[MFMailComposeViewController alloc] init];
mailVC.mailComposeDelegate = self;
[mailVC setSubject:emailTitle];
[mailVC setMessageBody:AppLink isHTML:NO];
[self presentViewController:mailVC animated:NO completion:nil];
}
Please provide any solution for it.

Does adding a subview to SDCAlertView work properly on iOS 8?

I had used an instance of SDCAlertView in my project to add a UITextView inside an alert to do some facebook posts.It doesnt seem to work properly anymore on ios8.
I had used the following code.
SDCAlertView *alert = [[SDCAlertView alloc] initWithTitle:#"Post To Facebook"
message:#""
delegate:nil
cancelButtonTitle:#"Cancel"
otherButtonTitles:#"Post", nil];
UITextView *textView = [[UITextView alloc] init];
[textView setTranslatesAutoresizingMaskIntoConstraints:NO];
[textView setEditable:YES];
textView.autocorrectionType = UITextAutocorrectionTypeNo;
[alert.contentView addSubview:textView];
[textView sdc_pinWidthToWidthOfView:alert.contentView offset:-5];
[textView sdc_pinHeight:120];
[textView sdc_horizontallyCenterInSuperview];
[textView sdc_verticallyCenterInSuperviewWithOffset:SDCAutoLayoutStandardSiblingDistance];
[alert showWithDismissHandler: ^(NSInteger buttonIndex) {
NSLog(#"Tapped button: %#", #(buttonIndex));
if (buttonIndex == 1) {
NSLog(#"POST %#", textView.text);
}
else {
NSLog(#"Cancelled");
}
}];
Result on iOS 7
Result on iOS 8 GM
Please let me know if I can fix this issue with some change in my code.
I managed to fix this problem by replacing following line
[textView sdc_verticallyCenterInSuperviewWithOffset:SDCAutoLayoutStandardSiblingDistance];
with the following:
[alert.contentView sdc_pinHeight:120 + SDCAutoLayoutStandardSiblingDistance];
[textView sdc_alignEdgesWithSuperview:UIRectEdgeTop insets:UIEdgeInsetsMake(SDCAutoLayoutStandardSiblingDistance, 0, 0, 0)];
If anyone wants to refer more about this discussion, please visit the following link
https://github.com/sberrevoets/SDCAlertView/issues/49

ViewDeck with Storyboard

I have some problems with ViewDeck with my app. I'm trying to use it with storyboard and the examples only shows how to use it with nibfiles. I have checked out many ways to do it here on stackexchange but i don't seem to get it to work.
My code in appdelegate.m file:
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{
//UIViewController* leftController = [[UIViewController alloc] init];
UIStoryboard *storyboard = [UIStoryboard storyboardWithName:#"MainStoryboard" bundle:nil];
RightViewController* rightController = [[RightViewController alloc] initWithNibName:#"RightViewController" bundle:nil];
ViewController* centerController = [[ViewController alloc] initWithNibName:#"ViewController" bundle:nil];
self.centerController = [[UINavigationController alloc] initWithRootViewController:centerController];
IIViewDeckController* deckController = [[IIViewDeckController alloc] initWithCenterViewController:self.centerController rightViewController:rightController];
deckController.rightSize = 100;
self.window.rootViewController = deckController;
[self.window makeKeyAndVisible];
return YES;
}
I of course i get the expected error:
2012-12-29 03:55:18.501 Network[27451:c07] *** Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: 'Could not load NIB in bundle: 'NSBundle </Users/Rostgaard/Library/Application Support/iPhone Simulator/6.0/Applications/C2BADD3B-660E-4363-8FC7-932B4E9D6172/Network.app> (loaded)' with name 'RightViewController''
*** First throw call stack:
(0x17cd012 0x15f2e7e 0x17ccdeb 0x755fac 0x61ae37 0x61b418 0x61b648 0x61b882 0xbcdf 0xe673 0xb7e2 0xada7 0x61d753 0x61da7b 0x61e964 0x581877 0x5885a3 0x580eed 0x56ab56 0x56adbf 0x56af55 0x573f67 0x2546 0x5377b7 0x537da7 0x538fab 0x54a315 0x54b24b 0x53ccf8 0x261adf9 0x261aad0 0x1742bf5 0x1742962 0x1773bb6 0x1772f44 0x1772e1b 0x5387da 0x53a65c 0x226d 0x2195 0x1)
libc++abi.dylib: terminate called throwing an exception
(lldb)
Here is the code I'm using which works fine:
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{
UIStoryboard* mainStoryboard = [UIStoryboard storyboardWithName:#"MainStoryboard" bundle: nil];
UIViewController* menuController = [mainStoryboard instantiateViewControllerWithIdentifier:#"LeftSideMenu"];
UINavigationController* navigationController = (UINavigationController *) self.window.rootViewController;
self.viewDeckController = [[IIViewDeckController alloc] initWithCenterViewController:navigationController leftViewController:menuController rightViewController:nil];
self.window.rootViewController = self.viewDeckController;
}
Well, solved this myself by using ECSlidingViewController instead, already optimized with storyboard.
https://github.com/edgecase/ECSlidingViewController
Just in case anyone runs into the same problem.
Try this tutorial project, it works

IBAction,button and camera

I have a button in my interface declared in .h file
#interface UserProfileVC : UIViewController <UIImagePickerControllerDelegate>{
IBOutlet UIButton *camera;
}
#property (nonatomic,retain) IBOutlet UIButton *camera;
-(IBAction)cameraPress:(id)sender;
And in my .m file i have:
-(IBAction)cameraPress:(id)sender{
UIImagePickerController *picker = [[UIImagePickerController alloc] init];
// [picker setDelegate:self];
[picker setAllowsEditing:YES];
picker.sourceType = UIImagePickerControllerSourceTypeCamera;
[self presentModalViewController:picker animated:YES];
[picker release];
}
But I have this error:
*** -[UserProfileVC performSelector:withObject:withObject:]: message sent to deallocated instance 0x7bc2a40
Can someone help me? I can't understand what is the mistake.
Thanks
As per the code from ur last comment,
-(void)showDetails:(id)sender{
NSLog(#"Annotation Click");
details= [[UserProfileVC alloc] initWithNibName: #"Details" bundle:nil ];
details.Nome=note.title;
addNavigationController = [[UINavigationController alloc] initWithRootViewController:details];
[self.navigationController presentModalViewController:addNavigationController animated:YES];
}
I can suggest you following.
If you look at the UIViewController class reference document, you will find below notes
presentModalViewController:animated:
Presents a modal view managed by the given view controller to the user. (Deprecated. Use presentViewController:animated:completion: instead.)
So I would suggest you to use presentViewController:animated:completion. I dont find it relevant to error "message sent to deallocated instance" but still check if u could solve your problem.
Also I dont know Why u wrote this line
addNavigationController = [[UINavigationController alloc] initWithRootViewController:details];
If you simply want to show UserProfileVC in the current UINavigationController then I would suggest you to remove addNavigationController line & write only
[self.navigationController presentViewController:details animated:YES completion:NULL];

MFMailComposeViewController gets exited while using in ipad and works fine in simulator

I am using this code and settings are provided to check whether mail account is set or not. But when it reaches the NSArray *toRecipients = [NSArray arrayWithObject: #"feedback#xyz"];
it gets aborted. My code is given below. MessageUI.framework is also provided fine.
MFMailComposeViewController *controller = [[MFMailComposeViewController alloc] init];
controller.mailComposeDelegate = self;
[controller setSubject:#"heading"];
[controller setMessageBody:#"some text" isHTML:NO];
NSArray *toRecipients = [NSArray arrayWithObject: #"feedback#xyz"];
[controller setToRecipients:toRecipients];
[self presentModalViewController:controller animated:YES];
[controller release];
The recipient email address is not valid.That's why problem occurred. Use this:
#"feedback#gmail.com"

Resources