How to keep my BCC in MFMailComposeViewController as readonly in iphone? - iphone

I am creating a project in which my app users can send mail within my app. While users sends each mail to their friends, i want that mail to send to my mail . so i added my mail in BCC. But the problem is user can easily delete my mail in BCC. I want my BCC to be not deletable .
I used the following code to send mail
MFMailComposeViewController* controller = [[MFMailComposeViewController alloc] init];
controller.mailComposeDelegate = self;
[controller setSubject:#"4 Frax"];
[controller setMessageBody:#"Hai dude" isHTML:NO];
[controller setBccRecipients:[NSArray arrayWithObject:#"office#4Frax.com"]];
if (controller) [self presentModalViewController:controller animated:YES];
[controller release];
Can anyone please tell me how to avoid user from deleting my mail in BCC.
Thanks in advance.

You can't, there is no API available to do this. Since this is a privacy issue. Apple will not allow you to get the user e-mail (or let them mail you it) without expres permission from the user.
Thus the mail composer will not allow you adjust, hide and fields. You can only prefill it.

I'm not sure that's a nice way to treat your users... but if you really want to do it I think your only option is to set up your own mail server and route your message through that. As rckoenes notes, there is no API to do it on iOS.

Related

ios UIActivityViewController not attaching images sending text messages

I'm using UIActivityViewController to share in Facebook,email,twitter and texting. Everything works just fine with the exception of texting. When I select the texting option it doens't attach the image to the text. Here is my code:
NSMutableArray *tmp=[[NSMutableArray alloc]init];
[tmp addObject:tmpImage];
[tmp addObject:#"Hello"];
NSArray *activityItems =[NSArray arrayWithArray:tmp];
UIActivityViewController *activityVC=[[UIActivityViewController alloc]initWithActivityItems:activityItems applicationActivities:nil];
[self presentViewController:activityVC animated:YES completion:nil];
any of you knows why is not attaching the image to the texting part?
I'll really appreciate your help.
In app MMS (multi-media messaging) is not supported for the current iOS, only SMS is supported.
Possible solutions include:
•copying the image to the clipboard and having the user paste it into the messaging text box manually. (You can open a texting app that supports mms via the URI scheme "sms://" (just load that URL)
•loading the images into the eMail application and sending the eMail as a text message to either one of your servers that can sort out the issue, to the iMessages eMail address, or to the sms/mms eMail address (ex. a phone number of 404-345-6789 with AT&T could receive a text message if an eMail was sent to 4043456789#txt.att.net, all major carriers have an eMail address for every phone number).

How do I design and implement password authentication for IOS?

I have what seems to be a simple issue but I can't find a solution. I have spent hours trying to find an example that shows how to build a view, allow a user to enter a password, authenticate the password and return the view to a designated view. I have found a lot a great resources on bits and pieces, but they all are somewhat vague on how to authenticate the password and then send the user to a designated view.
This seems to be the best solution to my problem, which is: I have several pdfs that I need to password protect in my iPad app.
Issue1: Prompt for userName and Password
Present a view modally. if username/password combination is correct, dismiss the modal view. alternatively, you can use an alert with textfields.
Issue2: Store username/password in a secure way
Use key chain as suggested in the other answer. USage of key chain is as simple as using NSUserDefaults with Carlbrown's PDKeychainBindingsController. You can find it at the below link
https://github.com/carlbrown/PDKeychainBindingsController
EDITED to add info requested in comment:
Assuming you are using a custom view controller for login prompt, you have to do something like this when you want to prompt for password. it can be in your application didFinishLaunchingWithOptions.
LoginViewController *controller = [LoginViewController alloc];
[self presentModalViewController:controller animated:YES];
[controller release];
Then in your LoginViewController, you have to do something like this.
PDKeychainBindings *keyChain =[PDKeychainBindings sharedKeychainBindings];
if ([[keyChain objectForKey:#"User Name"] isEqualToString:userName] && [[keyChain objectForKey:#"Password"] isEqualToString:passWord] ) {
[self dismissModalViewControllerAnimated:YES];
}else {
UIAlertView *alert = [[UIAlertView alloc] initWithTitle:#"ERROR" message:#"Wrong User Name and/or Password\nEnter Login Information Again"
delegate:self cancelButtonTitle:#"OK" otherButtonTitles: nil];
[alert show];
[alert release];
}
Please note that the strings userName and PassWord are captured from your textfields in login view controller.
In anticipation of your answer to my comment--
If you want the password to be stored locally, I would store it (hashed or otherwise) in the Keychain, to compare against the user-entered password. More in the Apple docs here.
I'd recommend downloading the Apple sample project for an example of storing/retrieving data from the keychain.
Oliver over at Cocoanetics.com has a very nice implementation of the security login screen apple uses. Look at the PinLockController class in MyAppSales.
https://github.com/Cocoanetics/MyAppSales
For keychain storage I use SFHFKeychainUtils. Its a simple method call to store and retrieve secure passwords. But I think standard NSUserDefaults would be sufficient for your needs.
(handy site http://gorgando.com/blog/tag/sfhfkeychainutils)
However, if you want to sell that app, keep in mind, that apple says
The user can set a four-digit personal identification number (PIN) to
prevent unauthorized use of the device, so there is no need for the
user to be authenticated and there are no authentication or
authorization APIs in iPhone OS.
This can be found in the Security Coding How-To's

iPhone MFMailComposeViewController

I have to send an email in one of the application,i have implement MFMailComposeViewController and everything is working fine, mail can be send and received also.
However my main issue is that, is it possible to send mail without opening the Sheet of MFMailComposeViewController ?
Means in my application I have to pass on url into suject field and have to type the recepients name in textfield, so is it that we cannot open the sheet of messagecontroller window and send the mail from the uibarbutton integration?
plz let me know that
If you dont want to use MFMailComposer, you may use following code.You have to handle you textfield's mail id's through string manipulation and append it in mString before body.you may use UItextview for body.
NSString *mString = #"mailto:foo#example.com?cc=bar#example.com&subject=Greetings%20from%20Cupertino!&body=Wish%20you%20were%20here!";
NSString *url = [NSString stringWithString:mString];
[[UIApplication sharedApplication] openURL: [NSURL URLWithString: url]];
To prevent spam from using the user mailbox, application cannot send mail automatically. THe user will have to press "Send" themselves. This way, they know what e-mail is going out.
If you want your app to automatically send mail, you will have to setup your own SMTP client/server.

how can i send sms programmatically in iphone

I need to send sms programmatically.
I found sending programmatically email in google,But did n't found clear info regarding sending sms programmatically.
Can any one pls post some sample code.
Thank u in advance.
You can prompt the user to send a message with the number to send it to filled out, along with the body of the message, but you cannot send an SMS without the user completing the send.
Here is a perfect blog that can be used to send sms through application. SMS sending through application is introduced with iOS4.0 So you can not use MFMessageComposer in the previous versions of iPhone.
iOS 4 will be the minimum requirement.
hAPPY iCODING...
-(void)displaySMSComposerSheet
{
MFMessageComposeViewController *picker = [[MFMessageComposeViewController alloc] init];
picker.messageComposeDelegate = self;
NSString *str=#"Your String for SMS"
picker.body=str;
[self presentModalViewController:picker animated:YES];
[picker release];
}
Use this and add framework MessageUI.framework and call this function whenever you want to send message

Multiple recipients using SMS URL on iPhone

Is there a way to use the SMS URL to open the SMS app with multiple recipients? I've tried similar approaches to the mailto: protocol but it's not playing nice.
Starting with iOS 4.x you can include multiple recipients as shown below:
MFMessageComposeViewController *controller = [[MFMessageComposeViewController alloc] init];
controller.recipients = [NSArray arrayWithObjects:#"1-222-333-4444", #"1-222-333-5555", nil];
As you probably noticed, the documentation does not mention any support for multiple recipients, so I think the answer is currently "No".
You could file an enhancement request here.