iPhone Display icon in Mail attachement forward actionsheet - iphone

How to show application icon in mail document forward actionsheet as shown below.
Description :
Any Document in Mail attachement.
Press and hold until you see action sheet like below image.
Please help me to show my application icon in this action sheet.

Your question is not clear.
Probably you are looking for UIDocumentInteractionController.
UIDocumentInteractionController allows your app to integrate with documents of specified format.
Check these tutorials :
Previewing Documents
Sharing Data
Import/Export Documents

You want to register your application for the file types you are able to receive. Documentation here:
http://developer.apple.com/library/ios/#documentation/FileManagement/Conceptual/DocumentInteraction_TopicsForIOS/Articles/RegisteringtheFileTypesYourAppSupports.html
To declare its support for file types, your app must include the CFBundleDocumentTypes key in its Info.plist property list file. (See “Core Foundation Keys”.) The system adds this information to a registry that other apps can access through a document interaction controller.

Related

Is it possible to attach a file to an ios calender event?

In Mac OS it is possible to attach files to a calender event and read that files on the iOS calender.
Question: Is it possible to attach a file to an iOS calender event using the Event Kit framework?
I could not find any hint in the Event Kit documentation
The short answer to your question is no - there is no way to attach a file to an iOS Calendar Event.
Why? Because there is no place to put a file. Looking at the EKEvent Class Reference turns up a short list of properties, none of which would work for our goal of adding a file to the event.
If we go up to the super class EKCalendarItem there are also no place to put a file.
However, what is it you are trying to do exactly?
If you want to attach a file on one device, say a photo of a cat, and then have that photo sync with the event to another device, you are out of luck. The documentation shows no place you could attach a binary blob to a calendar event.
However there are some other tricks you might want to try if you are ok only making it look like a file is attached:
EKCalendarItem has a notes property that stores an NSString. You could try something hacky like putting the file as binary data in a string format in there, but I wouldn't as thats silly and could break in all sorts of ways. If you are trying to just store plain text, though, that could work well.
If you want to link to the file using a URL you can put the URL in the notes property as another comment suggests, but I would suggest you use a different property - the URL property.
As for how you can give the impression there is a file attached to a calendar event (without actually being able to) I would suggest you look into the magic a good URL scheme can provide. I'm not sure what functionality you are looking for, but a URL scheme is an Apple approved way to tell your software to show a 'file' (Well, a view in your app that could be a file) by clicking a URL attached to a Calendar Event. You will still have to take care of getting the file onto the device, but that should get you closer to what you want. Good luck!
No, EventKit does not allow you to add an attachment to an EKEvent.
The only idea I can offer is to use the notes attribute to keep the file's url.
You can add an attachment like a photo in the OS X iCal application. When synced to you iPhone it will be visible in the iOS Calendar App.
Save it to Dropbox, copy the link and paste it to the URL box in Calendar Event. It's kind of wonky but it does work. Maybe Apple would do well to creat the functionality to link to photos, docs etc. It should be pretty straight forward.
I don't know if this was untrue at the time this was asked, but now... you certainly CAN add an attachment such as an image. AND...there are actually SEVERAL file types you can add!!
I wanted to add my mobile concert ticket & barcode image to the my iCal event so everything for the night would be consolidated.
Albeit this is more sort of a work around, because it's not done directly in your iOS iCal, but it's very much possible to do. (and all from your iOS device) You simply go about doing it through your iCloud within a browser.
TO ADD AN ATTACHMENT TO iCAL EVENT:
Open icloud.com in and enter your Apple ID and PW.
Double-click the event to open it (if it isn't open already).
Do any of the following: Click Add File next to “attachments,” locate the file on your computer, then click Choose. Drag the file into your event. ...
Click OK. A paper clip icon appears on the event to indicate there's an attachment.
SOURCE:
https://support.apple.com/kb/ph12080?locale=en_US
It is possible attaching files to your calendar entries! There is a little application for iPhone and iPad you can use (secretary-app.de).

Parsing an XML from an e-mail attachment

Is there a way to parse an XML which is attached to an e-mail directly from my app? I have implemented a parser which is reading it from the documents path, but would like to allow the user to be able to directly get it from an e-mail attachment too.
Assuming that you don't want to restrict it to jailbroken files, the easiest way is to register a filetype (Apple docs) with the extension of your data format, so XML if it is a generic XML or some other type if you want to make it specific to your application (and remember if you register XML you will get all XMLs, not just yours), then the user can click on the extension and get the 'Open in....' menu with your application shown in the list.
You need to impliment application:didFinishLaunchingWithOptions:, but it is all in the docs.
A better option would be to give it a filetype that is not commonly used by anything else, so that yours is the only one in the list. I get 4 apps on my iPad for opening XML
There is no way to automatically do it.

View PDFs and Office Documents from within own App?

I'm planning an iOS application which will allow browsing documents on my server using a WebService. The user will have the option to download documents (PDF and MS Office) to have them available offline.
Now I know that iPhone/iPad is capable of viewing all kinds of document formats, including PDF, DOC(X), XLS(X) if they are received through email for instance. I assume they are all handled by the same "preview module".
The question is: if I have the documents in my app's storage, how can I use the same functionality?
Solution in ObjC or MONOTOUCH is fine, or just pointing my into the right direction in general.
René
You can use the UIDocumentInteractionController which will present the user with a menu offering them "Quick Look" (which will open the file in the app) or the option to open the file in another app depending on what the user has installed.
Same sample code I've used looks like this (where e.Result is the result of a call to my web service).
string path = Environment.GetFolderPath(Environment.SpecialFolder.Personal);
string filePath = Path.Combine(path, e.Result.Filename);
if (!File.Exists(filePath))
{
File.WriteAllBytes(filePath, e.Result.DocumentData);
}
UIDocumentInteractionController docControl = UIDocumentInteractionController.FromUrl(NSUrl.FromFilename(filePath));
docControl.Delegate = new UIDocumentInteractionControllerDelegateClass(this);
InvokeOnMainThread(delegate {
docControl.PresentOptionsMenu(new RectangleF(0,-260,320,320), tbnv.View, true);
});
The delegate class contains overrides for the view where the preview view will appear (so you want to pass the current view to this and ensure that this is the view the preview will be presented in).
In my app, I allow users to view PDF's in-app by using a UIWebView control, and just loading the url of the PDF in it. That should work for internal PDFs also. I've never tried it with other types of docs, but I imagine the same approach would work.

(Iphone) associate an App to some file extension to open email attachments in Mail app

I found that some application, like "GoodReader" or "Docs to Go", once installed can be activated using the "Open in" function when opening an email attachment in the Mail App. How to add this function to have my App to be associated to some kind of documents (like pdf) ?
The idea is to have an easy way to get mail attachments to be used directly inside an app.
Edit: I found this document and think it fits my question:
Document Support
An application can now register the file types it supports with the system and receive notifications when a file of the given type needs to be opened. It does this by including the CFBundleDocumentTypes key in its Info.plist file. An application that registers one or more file types may also be expected to open files of those types at some point later. It does this by implementing the
application:didFinishLaunchingWithOptions:method in its application delegate and look for a file
in the UIApplicationLaunchOptionsURLKey key of the provided dictionary.
Complementing the ability to open files of known types is the addition of the
UIDocumentInteractionControllerclass in the UIKit framework. This class provides a user-based
interaction model for managing files that your application does not know how to open. The document
interaction controller provides options for previewing the contents of a file in place or opening it in another
application. Document interaction controllers are particularly useful for email applications or applications
that may download files from the network.
take a look at Custom URL Schemes and UIDocumentInteractionController. If you are looking to add the "open in" menu, the second link is what you need. If you are looking to register as a "PDF reader" this link (scroll to section about registering your app for certain types) should work iPad Programming Guide

how to open a file in iWork in the iPad

From what I understand, UIApplication -openFile can open files externally, the application depending on the URL scheme. Say I have a pages (or word maybe?) document, and I want to open it in pages from my app. Does anyone know the URL scheme for me to do that? Is there a list anywhere? (Keynote, and Numbers would also be useful).
It doesn't work that way because you cannot transmit the file via a URL and Pages cannot access a file that is stored in your app's sandbox.
If you want to give the user the option to open a file in Pages in your UI, UIDocumentInteractionController is the way to do that. It presents a UI where the user can preview the file and select to open it in any application that supports the file type.
AFAIK it is not possible with the SDK to do this completely programmatically, i.e. without user interaction.