The problem that you want to perform on main thread on the current object, but your object will be released once you call self dismissModalViewControllerAnimated:YES.
Up vote 0 down vote favorite share g+ share fb share tw.
In my iOS app, I am trying to send Tweet once sending the SMS. What the problem here is it shows the sms screen and tap send button then the control comes to my "Send Tweet" method but it is not showing the "Tweet" Sending Screen. And when I call my "Send Tweet" method without calling the sms sending funtions , it works and shows the tweet sending screen.
But why is not showing the tweet sending screen after sending the sms. //================================================================================= - (void)messageComposeViewController:(MFMessageComposeViewController *)controller didFinishWithResult:(MessageComposeResult)result { //================================================================================= switch (result) { case MessageComposeResultCancelled: NSLog(@"Result: canceled"); break; case MessageComposeResultSent: NSLog(@"Result: sent"); self logSMSSentInfo; break; case MessageComposeResultFailed: NSLog(@"Result: failed"); break; default: NSLog(@"Result: not sent"); break; } self dismissModalViewControllerAnimated:YES; self performSelectorOnMainThread:@selector(SendTweet) withObject:nil waitUntilDone:NO; } // this function is to send tweet //============================================ -(void)sendTweet:(NSString*)inTweetAccountInfo{ //============================================ if (TWTweetComposeViewController canSendTweet) { NSString *aTweetMsg; } } iphone ios ios5-sdk link|improve this question edited Feb 10 at 9:37 asked Feb 10 at 8:56user198725878889528 69% accept rate.
Or just before the dismissModalViewControllerAnimated. – antf Feb 10 at 9:06 @antf : Thanks for the reply and tried your way but it is not working even now – user198725878 Feb 10 at 9:27 self is presented modal? – Alex Terente Feb 10 at 9:33 @TerenteIonutAlexandru : YEs for this self dismissModalViewControllerAnimated:YES; – user198725878 Feb 10 at 9:45 it shows the tweet screen when I used the afterDelay paramater as below self performSelector:@selector(SendTweet) withObject:nil afterDelay:1.0; how is that working – user198725878 Feb 10 at 11:04.
The problem that you want to perform on main thread on the current object, but your object will be released once you call self dismissModalViewControllerAnimated:YES; So you need to pass the sendTweet method to a living object. Edit: You can implement a delegate protocol and tell to the viewController that presents your modalView to sendTweet( the send tweet method have to be in the parentViewController).
Thanks for the reply..Pls let me know how I should call that method – user198725878 Feb 10 at 10:04.
Why don't you use a Notification Center instead of performSelectorOnMainThread as described here. In case you need more details about Notification Center you might like to look here. I hope this helps.
I cant really gove you an answer,but what I can give you is a way to a solution, that is you have to find the anglde that you relate to or peaks your interest. A good paper is one that people get drawn into because it reaches them ln some way.As for me WW11 to me, I think of the holocaust and the effect it had on the survivors, their families and those who stood by and did nothing until it was too late.