iPhone - MessageUI - framework not found Message - iphone

I want to be able to use the iPhones Mail.app inside my application so my users can send a share email without leaving the application. I know 3.0 made this possible.
I have added the framework properly by ctrl clicking on my frameworks folder -> add existing framework.
Added this to the header file of the viewcontroller I want the Mail.app to appear in.
#import <MessageUI/MessageUI.h>
I pop up a UIAlert and on closing I call the function below, There are no errors showing up in my code. Do I have to do something extra inside the Interface Builder? Error Msg is Below
-(void)showEmailModalView {
MFMailComposeViewController *picker = [[MFMailComposeViewController alloc] init];
picker.mailComposeDelegate = self; // <- very important step if you want feedbacks on what the user did with your email sheet
NSString * emailSubject = [[NSString alloc] initWithFormat:#"iPhone Subject Test"];
[picker setSubject:emailSubject];
NSString * content = [[NSString alloc] initWithFormat:#"iPhone Email Content"];
// Fill out the email body text
NSString *pageLink = #"http://mugunthkumar.com/mygreatapp"; // replace it with yours
NSString *iTunesLink = #"http://link-to-mygreatapp"; // replate it with yours
NSString *emailBody =
[NSString stringWithFormat:#"%#\n\n<h3>Sent from <a href = '%#'>MyGreatApp</a> on iPhone. <a href = '%#'>Download</a> yours from AppStore now!</h3>", content, pageLink, iTunesLink];
[picker setMessageBody:emailBody isHTML:YES]; // depends. Mostly YES, unless you want to send it as plain text (boring)
picker.navigationBar.barStyle = UIBarStyleBlack; // choose your style, unfortunately, Translucent colors behave quirky.
[self presentModalViewController:picker animated:YES];
[picker release];
[content release];
[emailSubject release];
}
- (void)mailComposeController:(MFMailComposeViewController*)controller didFinishWithResult:(MFMailComposeResult)result error:(NSError*)error
{
[self dismissModalViewControllerAnimated:YES];
}
My ERROR MESSAGE:
ld: framework not found Message
collect2: ld returned 1 exit status
I followed this tutorial:
http://blog.mugunthkumar.com/coding/iphone-tutorial-in-app-email/

After doing some research I found out that the tutorial I was using was perfectly fine! The code had no errors and my problem was the way I added the MessageUI Framework to my project.
Wrong Way.
Ctrl-click on the frameworks folder and select add -> existing frameworks..
Correct Way.
Open up "targets" in the file panel on the left of your xcode screen, double click your project name. A new window will pop open, at the bottom of the new window you can add a new linked library, add one by clicking the little plus sign in the bottom left hand corner. Scroll down to MessageUI and select Add.
If you had already added the MessageUI Framework the wrong way, just simply delete it and proceed with the correct way. If it still doesn't work try shutting down xcode, restarting, and rebuilding your application.
After many hours of searching for an answer this is what worked for me.

The linker command line output will tell you a lot about what XCode is using to try and build your binary, including Framework include paths and the frameworks the linker is including in the build. From there you'll be able to see exactly what XCode is using and what might be missing from your settings. The command line output can be found in one of the output panes in the Build Results window.

Related

Sending sms from phonegap in iphone?

Is it possible to send sms using phonegap in iphone??If yes can anybody suggest me sample code or tutorials to do so???
Is it possible to find out user's phone number using phonegap in iphone??If yes can anybody suggest me sample code or tutorials to do so???
If you want to send sms via phone first you should create a plugin(see phonegap website to see how its done) then in plugin code(it should be native code do it like this :
You must add MessageUI.framework to your Xcode project and include a #import <MessageUI/MessageUI.h> in your header file.
Add these delegates to your header file MFMessageComposeViewControllerDelegate & UINavigationControllerDelegate.
In your IBAction method declare instance of MFMessageComposeViewController say messageInstance to check whether your device can send text use [MFMessageComposeViewController canSendText] in if condition, it'll return Yes/No in the if condition do these:
MFMessageComposeViewController *messageInstance = [[[MFMessageComposeViewController alloc] init] autorelease];
// set body for your messageInstance
messageInstance.body = #"Hello from Shah";
// then decide the recipients for the message as:
messageInstance.recipients = [NSArray arrayWithObjects:#"12345678", #"87654321", nil];
//Set a delegate to your messageInstance as:
messageInstance.messageComposeDelegate = self;
// Then present the messageViewController
[self messageInstance animated:YES];

How to develop a SMS client for iOS?

my original title was How to customize TTMessageController for SMS transmission?. I changed this now because I look for any possible solution and not only those with TTMessageController.
Well, I am working on an simple application in xcode4. The user should be able to send SMS from different SMS gateways.
The background logic is quite simple because everything is managed by executing some http requests on an rest api.
The hard thing for me now is to setup the UI and that is where I need help because I am new to iOS development. This is how I want it to be:
http://img222.imageshack.us/img222/3159/bhrfe.png
There should be a recipient picker to either do autosearch on contacts or to directly pick a contact from the contact list. Beside I want only one recipient. And there should be a text area.
I also want to have a label somewhere at the bottom to show the current char number.
Since I did not find those UI elements in xcode4 library I searched for something similar and I found the TTMessageController which gives me the view you see in the picture.
However plus button does not work and I am not sure how to extend all this to do what I want.
I appreciate any idea on this.
For the + Button you can use the address book UI:
// This Code is taken from Apple's sample code QuickContacts
#import <AddressBookUI/AddressBookUI.h>
-(void)showPeoplePickerController {
ABPeoplePickerNavigationController *picker = [[ABPeoplePickerNavigationController alloc] init];
picker.peoplePickerDelegate = self;
// Display only a person's phone, email, and birthdate
NSArray *displayedItems = [NSArray arrayWithObject:[NSNumber numberWithInt:kABPersonPhoneProperty]];
picker.displayedProperties = displayedItems;
// Show the picker
[self presentModalViewController:picker animated:YES];
[picker release];
}
The <ABPeoplePickerNavigationControllerDelegate> delegate include this methods:
– peoplePickerNavigationController:shouldContinueAfterSelectingPerson:
– peoplePickerNavigationController:shouldContinueAfterSelectingPerson:property:identifier:
– peoplePickerNavigationControllerDidCancel:
After selecting a person you can save his/her number in an array and in the text field (e.g. comma separated)
.
For the question if it will be approved here is the guideline:
https://developer.apple.com/appstore/resources/approval/guidelines.html
22.6 Apps that enable anonymous or prank phone calls or SMS/MMS messaging will be rejected
You can't use TTMessageController to send sms. The only possible way to send sms is to use MFMessageComposeViewController. Here's a tutorial on how to use it: http://blog.mugunthkumar.com/coding/iphone-tutorial-how-to-send-in-app-sms/

What does "WARNING: Input manager failed to load static dictionary for: nl_NL" mean?

I've been working on a dutch localization of a xib file. When I run my app in the simulator, I get the following message in the log console:
WARNING: Input manager failed to load static dictionary for: nl_NL
I've tried to reset the simulator, I've deleted the app, I removed the localization stuff and added it again, I've cleaned my project, but nothing seems to work. I keep getting this warning message.
My questions:
- can I ignore it?
- how can I get rid of this warning?
I've searched the web, but can't seem to find any answer.
If it happens only in the simulator and doesn't cause any other issues, I wouldn't worry too much about it. I just saw this warning for the first time today too.
Some follow-up questions may help:
Which SDK are you using?
Does it happen if you create a new Xcode project from a template?
Is your app still loading the localized nib correctly?
I get the same message when I localise to Spanish (es_ES), but not when I localise to Japanese and to Simplified Chinese (or English for that matter).
I haven't been able to trace the cause or fix this. However in my case this is definitely not the localised xib files, but it arises when I call:
- (NSString *)language {
NSSet *supported_languages = [NSSet setWithObjects: #"en", #"es", #"ja",
#"zh-Hans", nil];
NSUserDefaults *defs = [NSUserDefaults standardUserDefaults];
NSArray *languages = [defs objectForKey:#"AppleLanguages"];
NSString *primary_language = [languages objectAtIndex:0];
if ([supported_languages containsObject:primary_language]) {
return primary_language;
}
return #"en";
}
But this is only in the simulator.
On the device it works just fine as far as I can tell and I'm ignoring it.
I'm using the 4.2 SDK. I've created the project from a template. It's still loading the localized nib correctly.
What I did find out was the following: it seems to happen only if I run the following code in the didFinishLaunchingWithOptions selector inside the AppDelegate.m file:
AboutViewController *controller = [[AboutViewController alloc]
initWithNibName:#"AboutViewController" bundle:nil];
[self.window addSubview:controller.view];
[self.window makeKeyAndVisible];
If I comment out these lines, and replace it with another subview, it doesn't happen. The AboutViewController nib was the one which was localized. If I display the same view when the user clicks on an (i) information button, it just works and without the warning. It just gives me the warning when I do it from the AppDelegate.

save videos in iphone simulator & upload it to the web services

I just want to know that how I can save the videos to the iphone simulator & how I can upload it to the web services?
Thanks.
vpc=[[UIImagePickerController alloc] init];
vpc.delegate=self;
vpc.sourceType = UIImagePickerControllerSourceTypePhotoLibrary;
vpc.mediaTypes = [UIImagePickerController availableMediaTypesForSourceType:vpc.sourceType];
vpc.allowsEditing = NO;
vpc.mediaTypes = [NSArray arrayWithObject:(NSString *)kUTTypeMovie];
[self presentModalViewController:vpc animated:YES];
i am doing this it gives an error, kuTType undeclared before it used, i dont know about the kuTTypeMovies, please reply as soon as possible.
Thanks
I think you are missing one of below framework
libz.1.2.3.dylib
MobileCoreServices.framwork
SystemConfiguration.framwork
You need to import framework #import MobileCoreServices/UTCoreTypes.h
If u got an error when u import framework.try below method I found.
1) open your project profile
2) build phases > link binary with libraries
3) click + , add MobileCoreService framework
4) now see it in left side.In the Headers folder of framework.find file name MobileCoreServices.h
5) Now open .h file, simple drag it below #import UIKit/UIKit.h
Note : make sure you need to drag it into #import<....>
Now what...? Thats it.You can see KuTTYpeMovie in .m file...thanks

iPhone - Anyway to get iPhone's Email App Inside Your Own App?

Has anyone every embeded the iPhone's Email program inside your own App?
Let me try and simplify that. Tap Tap Revenge allows you to "Challenge A Friend". When you choose to do so they open the standard iPhone email program (if they mimicked it, it looks damn good), within the application with pre-populated data. All you have to do is select a friend from your contacts and press send. You never leave the Tap Tap Revenge App.
Any ideas how this is done?
You need to include the MessageUI.framework into your project, and inside your header file you need to set the delegate:
#import <MessageUI/MessageUI.h>
#interface RootViewController : UIViewController <MFMailComposeViewControllerDelegate> {
MFMailComposeViewController *email;
}
#property (nonatomic, retain) MFMailComposeViewController *email;
Once you do that, you have a few delegate methods inside your implementation file you need to include (You should check to see the result, but I am trying to keep as little code as needed):
#synthesize email;
- (void) mailComposeController:(MFMailComposeViewController *)controller didFinishWithResult:(MFMailComposeResult)result error:(NSError *)error {
[email dismissModalViewControllerAnimated:YES];
}
Wherever you want to use this, you need to initialize and set it up like this:
email = [[MFMailComposeViewController alloc] init];
email.mailComposeDelegate = self;
// Subject
[email setSubject:#"Testing"];
// Optional Attachments
NSData *artwork = UIImagePNGRepresentation([UIImage imageNamed:#"albumart.png"]);
[email addAttachmentData:artwork mimeType:#"image/png" fileName:#"albumart.png"];
// Body
[email setMessageBody:#"This is the body"];
// Present it
[self presentModalViewController:email animated:YES];
Further to Garett's great response, should you get the warning:
'MFMailComposeViewController' may not respond to '-setMessageBody:'
add isHTML: so the complete line reads like:
[mail setMessageBody:#"This is the body" isHTML:NO];
There is two answers for that. For applications that should support iPhone OS prior 3.0 the only way to go is to build a custom message composer. Or you may want to have a look at the component built by Joe Hewitt who wrote the Facebook iPhone app.
http://github.com/joehewitt/three20/blob/master/src/Three20/TTMessageController.h
With iPhone SDK 3.0 you are able to use the Mail message composer UI straight out if the box using the MessageUI.framework as explained above.
messagecomposer is the way to go! mails and sms inside the app, run from iOS 3.1. need sdk 4