Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8993955
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T23:18:39+00:00 2026-06-15T23:18:39+00:00

Implemented Uniform Type Identifiers and when emailed a single attachment, stringWithContentsOfURL returns an NSString

  • 0

Implemented Uniform Type Identifiers and when emailed a single attachment, stringWithContentsOfURL returns an NSString with the contents of the file defined by the NSURL.

When selecting a file from an email with a number of files attached, stringWithContentsOfURL returns all files attached, with header information, as an NSString.

Is there a way to open just the selected file?

Update:

  • First file user touches, file processed as expected. user can touch as many times and all is good.
  • Any subsequent file touched, the email’s raw source, minus email header, will be saved as a file represented by the NSURL.
  • This behaviour has been observed on iphone 6.0.1 and ipad 5.1.1.

You could parse the raw source and determine which file was selected from the NSURL, potentially problematic I think.

End Update

Code (url in both cases point to a single file). The file extension is *.defects

NSString *file = [NSString stringWithContentsOfURL:url encoding:NSUTF8StringEncoding error:&error];

Result for mail with single attachment

"Defect Names"
"Test1 Area"
"Test2 Area"
"Test 3 Area"
"Test 4 Area"
"Extra"

Result for mail with multiple attachments

--Apple-Mail=_785C0CB9-CB2F-43BE-AD5F-D7DEF5F97EFC
Content-Disposition: attachment;
    filename=Areas.defects
Content-Type: defects/x-defects;
    x-unix-mode=0644;
    name="Areas.defects"
Content-Transfer-Encoding: 7bit

"Area of Defect"
"Test1 Area"
"Test2 Area"
"Test 3 Area"
"Test 4 Area"
"Extra"

--Apple-Mail=_785C0CB9-CB2F-43BE-AD5F-D7DEF5F97EFC
Content-Disposition: attachment;
    filename="pos.defects"
Content-Type: defects/x-defects;
    x-unix-mode=0644;
    name="pos.defects"
Content-Transfer-Encoding: 7bit

"Position of Item"
"Test1 Position"
"Test2 Position"
"Test 3 Position"
"Test 4 Position"
"Extra"

...
--Apple-Mail=_785C0CB9-CB2F-43BE-AD5F-D7DEF5F97EFC--
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-15T23:18:41+00:00Added an answer on June 15, 2026 at 11:18 pm

    While I am surprised by this behavior (I would have expected to only see the attachment that the user taps on) this is not hard to solve.

    You can easily write a multipart MIME scanner that splits up a multipart message into the individual attachments.

    Are you certain that you actually have individual files inside the email that is being sent? Inspect the raw message.

    Also you might have set up your UTI registration incorrectly, please read my writeup: http://www.cocoanetics.com/2012/09/fun-with-uti/

    Usually if you open an app via the File Open In (fom another app) you are getting passed a file URL that points to a copy of said file places in the receiving app’s Document/Inbox folder. Inspect this URL to see what kind of file the system places there. If you don’t remove it, then you can copy the contents of your app folder to the desktop with Xcode organizer.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I implemented the following code: NSURL *url = [ NSURL URLWithString:[ NSString stringWithFormat: @http://www.google.com/search?q=%@,
Implemented a generic repository with several Methods. One of those is this: public IEnumerable<T>
I implemented the Facebook registration on my website. Everything works fine except that suddenly
I implemented the exception filter like here: http://www.asp.net/web-api/overview/web-api-routing-and-actions/exception-handling And registered it globally, like microsoft
We implemented In-app Billing one year ago with no problems following the sample code
I implemented my project for notification. I tested it in development Provisioning Profile (development
I implemented Adwhirl into my new universal app. And was able to get the
I implemented class that serves as TcpCLient server. Looks like this: { [Export] public
I implemented some code using backbone.js in Asp.NEt MVC3 and found backbone.js very helpful.
I implemented sherlockactionbar in my project and it works great, but I don't know

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.