Advertise Mobile SDKs Books Events Forum News Social Networking Support Us
Follow @iphonedevsdk on Twitter

Interface 2, Advanced iOS
Mockup & Code Gen
($9.99)

Make your own iPhone apps
and run them live!
(free)

Pic Frame Dynamo: Photo Editing
($0.99)

Abiliator
($1.99)

Want your application or service advertised on iPhone Dev SDK?

Go Back   iPhone Dev SDK Forum > iPhone SDK Development Forums > iPhone SDK Development

Reply
 
LinkBack Thread Tools Display Modes
Old 09-09-2011, 05:11 AM   #1 (permalink)
Registered Member
 
Join Date: Aug 2011
Posts: 53
thehindutimes is on a distinguished road
Default MFMailComposer

Does anyone know what might be wrong when I get a SIGABRT on this line?


MFMailComposeViewController *composer = [[MFMailComposeViewController alloc] init];
[composer setMailComposeDelegate:self];
if ([MFMailComposeViewController canSendMail]) {
[composer setToRecipients:[NSArray arrayWithObjects:@"", nil]];
[composer setSubject:@""];
[composer setMessageBody:[order count] isHTML:NO];
[composer setModalTransitionStyle:UIModalTransitionStyleCros sDissolve];
[self presentModalViewController:composer animated:YES]; <-------------- this line
[composer release];
}
else
[composer release];


It says "unrecognized selector sent to instance"

What does that mean?
thehindutimes is offline   Reply With Quote
Old 09-09-2011, 05:33 AM   #2 (permalink)
Registered Member
 
Join Date: Nov 2010
Posts: 1,106
Meredi86 is on a distinguished road
Default

We need more than just the "Unrecognised selector sent to instance" It should tell you something like:

[UIVeiewController presentModalViewController] unrecognised selector....

Basically it is saying that whatever the message you are sending is is not known by the receiver - think about trying to put a square shape into a circle.

so you could have something like :
Code:
[NSArray objectAtIndex] unrecognised selector sent to instance 0x3g435a
And that would mean hat NSArray doesn't have a method known as objectAtIndex and therefore does not know what to do with what you are sending to it.

Hope that helps

p.s. is this a typo on he post or in the code?:
Code:
[composer setModalTransitionStyle:UIModalTransitionStyleCros sDissolve];
obviously in the code there shouldn't be a space between the two s's
Meredi86 is offline   Reply With Quote
Old 09-09-2011, 05:59 AM   #3 (permalink)
Registered Member
 
Join Date: Mar 2010
Posts: 90
LittleX1 is on a distinguished road
Default

If you are calling presentModalViewController:Animated: on self, self must be of type UIViewController.
LittleX1 is offline   Reply With Quote
Old 09-09-2011, 06:53 AM   #4 (permalink)
Registered Member
 
Join Date: Aug 2011
Posts: 53
thehindutimes is on a distinguished road
Default

ok, well self is not a UIViewController so what should I call it on then?

The whole app is in a tab bar controller and the button calling the instance is in a navigation controller.

that's a typo on the post Meredi86

it says -[multiviewAppDelegate presentModalViewController:animated:]: unrecognized selector sent to instance 0x6a2a98
thehindutimes is offline   Reply With Quote
Old 09-09-2011, 07:00 AM   #5 (permalink)
Registered Member
 
Join Date: Nov 2010
Posts: 1,106
Meredi86 is on a distinguished road
Default

OK so you are trying to present it on top of the App delegate.

As a side note from that, have you added the navigation controller and the tab bar controller to the app delegate and then just using that as the start?

That isn't the best way to go around it, and i think a few people would tell you that it would make your app rigid.

I have to go for lunch now, but if no one else has come and helped you fix this then ill drop back in.

Basically you need to be adding on top of the app delegate a UIViewController and then using that to build your app around rather than on top of the app delegate.

So it would go:

AppDelegat -> UIViewController ->UITba/Nav controller
Meredi86 is offline   Reply With Quote
Old 09-09-2011, 07:20 AM   #6 (permalink)
Registered Member
 
Join Date: Aug 2011
Posts: 53
thehindutimes is on a distinguished road
Default

ok, I think I might done it the wrong way then.
In my MainWindow.xib I've put a tab bar controller and in that there's a navigation controller. And in that navigation controller is the button calling the mail method.

So I guess I've got AppDelegate -> TabBarController -> NavigationController then?
thehindutimes is offline   Reply With Quote
Old 09-09-2011, 08:00 AM   #7 (permalink)
Registered Member
 
Join Date: Nov 2008
Posts: 864
nobre84 is on a distinguished road
Default

A TabBarController IS a UIViewController (subclass), that hierarchy is fine. What is wrong is that your AppDelegate is trying to show the MFMailComposer modally, but a modal can only be shown from a UIViewController. Why is this method located on your App Delegate ?
To solve it you could have [self.tabBarController presentModalViewController:...] . But if you can, you should move this inside one of your view controllers and present from self.
nobre84 is offline   Reply With Quote
Old 09-09-2011, 08:16 AM   #8 (permalink)
Registered Member
 
Join Date: Aug 2011
Posts: 53
thehindutimes is on a distinguished road
Default

ok, I did it like this because it was the only way I could get a navigation bar at the top of the window.

If I try to to add a toolbar/navbar in the view it won't show up. That view is a tableView being created with a custom cell Class and for some reason the tableView is the only thin that will show in that view.
thehindutimes is offline   Reply With Quote
Old 09-09-2011, 08:54 AM   #9 (permalink)
Registered Member
 
Join Date: Nov 2010
Posts: 1,106
Meredi86 is on a distinguished road
Default

Glad you have it working now.

TabBars and Nav bars all together can take a bit of getting used to. There are some very good docs on it in the Apple view programming guide - those are what let me figure out how to set mine up correctly - before i was just messing around and finding it difficult to understand and get working. If you havnt already i would suggest reading up on this. there is a specific section on how to integrate both a tab bar and nab bar together, and how to then add those to your app in the correct method.

Good luck moving forwards
Meredi86 is offline   Reply With Quote
Old 09-09-2011, 08:56 AM   #10 (permalink)
Registered Member
 
Join Date: Aug 2011
Posts: 53
thehindutimes is on a distinguished road
Default

Cheers mate!
thehindutimes is offline   Reply With Quote
Reply

Bookmarks

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On



» Advertisements
» Online Users: 408
9 members and 399 guests
apatsufas, Eclectic, JackReidy, jeroenkeij, Sami Gh, tim0504, UMAD, yomo710, yuncarl28
Most users ever online was 1,387, 04-10-2012 at 04:21 AM.
» Stats
Members: 175,672
Threads: 94,121
Posts: 402,904
Top Poster: BrianSlick (7,990)
Welcome to our newest member, yuncarl28
Powered by vBadvanced CMPS v3.1.0

All times are GMT -5. The time now is 04:59 AM.
Powered by vBulletin® Version 3.8.0
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.3.0