First of all, I'm working on an in-house app, so I don't need approval at App Store. I know it wouldn't ever be accepted, but it's a business rule our users share some content of the application, but with a default message and subject, so they can't edit these fields..
Until iOS 5 I was able to navigate by the view hierarchy and let the fields unneditable. But with iOS 6, and the mail on another proccess, I can't do it anymore.
I need to block the views for editing (I put a view over all the mail view, except the title bar, and it works, but when the user try to cancel the e-mail, my view is blocking the popover to delete or save draft too) or send e-mails without the UI (I was able to do it with Stealth Messenger based code (https://github.com/0xced/Stealth-Messenger/) at iOS 4 or 5, but now it doesn't work).
I tryed everything I could with private APIs and Objective-C runtime.. I can dismiss the view with sending e-mail ok, but the e-mail itself isn't sent.
Can anybody help me? Does anybody did it?
Thanks in advance..
Take a look at this: Send Email in Background from iOS
IOS doesn't support to mail in background. [...] As an alternate you
should implement the WebService for this[...]
Probably the best option is to utilise some server code and call that with NSURLRequest.
Hope that helps.
I do this in an app of mine. I have a simple PHP script on a webserver that uses the PearPHP mail modules to send SMTP mail. The PHP script takes a few incoming variables, like $toAddress, $subject, $message and then connects to the SMTP server and sends the mail out.
Unfortunately, you're not allowed to subclass the MFMailComposeViewController, and if you were using some sort of Invisible UIView to block fields, that was just a workaround that's probably been broken. (They did the same thing with being able to insert a "." on the NumberPad keyboard)
Related
I've seen some apps that allow you to share content with ios's mail, messages, print and copy.
I see there is a project called sharekit that does something similar but integrates social network sharing. Personally I don't need the social sharing, so sharekit it probably overkill.
I just need to popup an actionsheet that will allowe me to pass some text for example to the mail app or the messages app.
What you are looking for is the MessageUI.framework.
This framework contains:
MFMailComposeViewController
this class will allow your user to compose an e-mail.
MFMessageComposeViewController this class will allow your to compose a SMS message. MMS is not supported.
You will have to write the action sheet you self, but after the user made there choice you can create an instance of MFMailComposeViewController or MFMessageComposeViewController and present it to the user.
Be aware that you will need to implement the MFMailComposeViewControllerDelegate and/or MFMessageComposeViewControllerDelegate to dismiss the view.
Look my answer here:
https://stackoverflow.com/a/13975189/736384
I wrote about the new UIActivity control, It let you do all you are looking for.
If all you want to do is integrate with Mail or Messages, use the MFMailComposeViewController and MFMessageComposeViewController classes respectively.
If you want to add support for Copy, Print, and other such "activities', take a look at the documentation for UIActivity and UIActivityViewController.
I have made one application, In my application I want to send message on some mobile no.
I know, this is done using MFMessageComposeViewController.
but, can we send message without open the MFMessageComposeViewController ?
Can we use MFMessageComposeViewController in background and send message on some mobile no ?
any one has idea then pls help me...
As we said before (you can search here in StackOverFlow), user interaction has to be called.
What if your application send spam messages ? What if it send message to a plateform you own with taxed messages ?
So the answer is no.
you can use ShareKit without UI but you cant do that for mail or SMS
I am not sure this can be done at all...
Background: I am constructing an in-house application which means it does not get into appstore so i am not limited by the appstore guidelines.
I have a dylib which loads before the main application. It is a kind of augmenting library for applications. I am using the constructor __attribute__ to load my stuff. In there i would like to put an alertview or any kind of popup which will receive a user/password question. If the password is correct than the user is allowed to continue into the original application.
Since this is in the dylib i do not yet have a UIApplication and i do not want to interfere in the original application or sources.
Suggestions, tips are welcome...
Thanks.
This is how i've done very similar thing in my application:
0) Intercept applicationDidFinishLaunching message, add your own code, run original implementation.
1) Make opaque fullscrean UIWindow (for example, black).
2) Set its windowLevel to UIWindowLevelAlert + 1 So it hides every other window in app.
3) Add fields for user and password to this UIWindow.
I'm pretty sure you can't show a UIAlertView without having initialized the UIApplication and UIWindow instance.
Only the iOS itself can show alerts outside the application, for example when it asks for permissions or in case of iTunes or game center login ...
As a workaround you can:
make a login view inside the application
create a web application for the login process. The web app could launch the native app with a custom URL scheme and pass parameters like 'user' and 'password' to the app.
You should create a View for the Login then if you pass the login you can go on using the app otherwise you just make the app shut itself.
You could start a thread when loading your dylib and make it listen for your UIApplication to become available, then display the alert on the main thread.
I need to work on an application able to send a mail with automatic content (subject/text) that the user shouldn't be allowed to edit. Is it possible to do ?
Thanks for your advices
The answer is "no". If you want to use the MFMailComposeViewController class, you have to pay attention to this paragraph in Apple's documentation:
Important The mail composition interface itself is not customizable
and must not be modified by your application. In addition, after
presenting the interface, your application is not allowed to make
further changes to the email content. The user may still edit the
content using the interface, but programmatic changes are ignored.
Thus, you must set the values of content fields before presenting the
interface.
The user can (and should be able to) change anything and everything s/he wishes before they send out an e-mail.
If you don't want to follow those rules Apple set, there are other mail frameworks you can use within your iOS app.
since iOS 5, notifications are no more intrusive as previous. This is nice, but it seems that users prefer to tap directly on app icon from the Dashboard instead of the (small) banner area or notification center.
In such case, my app cannot get payload from notifications.. Even the 'application didReceiveRemoteNotification' method is not able to get the notification.
Has anyone got the same issue? Do you have any advice?
Thanks
The intention of the push payload is just to display something useful/informative to the user in the alert. Not to actually send data to your app.
So you will need your own web service to provide the data your app needs. Your app should refresh/sync to that service when it launches to get the data.
Example: Instagram. It can push notify you that someone commented on your photo. But it's not actually sending the comment data in the push to display in the app. The comment data is downloaded when you launch Instagram and attempt to view the comment.