Saturday, 17 August 2013

How to remove the path from an attachment when calling addAttachmentData?

How to remove the path from an attachment when calling addAttachmentData?

When adding an attachment to an email, the file name gets it's complete path.
For a file located in:
/var/mobile/Applications/C3BBAA5F-07FE-4E26-9661-CB492E06BD2E/Documents/
I'm getting as a result, a file named:
_var_mobile_Applications_C3BBAA5F-07FE-4E26-9661-CB492E06BD2E_Documents_Clock.sqlite
When I need my filename to be:
Clock.sqlite
Here's my code:
NSString *path = [self getDatabaseFilePath];
NSData *myData = [NSData dataWithContentsOfFile:path];
[picker addAttachmentData:myData mimeType:@"application/x-sqlite3"
fileName:path];
How can I get the attachment to have only the filename and extension,
without the complete path?
Thank you!

No comments:

Post a Comment