Go Back   MacRumors Forums > Apple Systems and Services > Programming > iPhone/iPad Programming

Reply
 
Thread Tools Search this Thread Display Modes
Old Jan 27, 2013, 09:08 AM   #1
newtoiphonesdk
macrumors 6502a
 
Join Date: Jul 2010
Attach PKPass To Email in App

I am using PassSlot which creates a Pass on the fly that can be added to passbook. I am trying to get it downloaded to the device to allow attaching to an email. Here is what I have so far:

Code:
           
    [PassSlot passFromTemplateWithName:@"LoveCouponCards" withValues:values pass:^(PSPass *pass) {
        [PassSlot downloadPass:pass pass:^(PSPass *pass) {
            PKPass *pkpass = [pass performSelector:@selector(pass)];
            NSLog(@"Pass: %@", pkpass);
            

            MFMailComposeViewController *picker = [[MFMailComposeViewController alloc] init];
            picker.mailComposeDelegate = self;
            
           
            NSArray *toRecipients = [NSArray arrayWithObject:@"friend@example.com"];
            
            
            [picker setToRecipients:toRecipients];
           
             NSURL *url = pkpass.passURL;
     NSData *thepassdata = [NSData dataWithContentsOfURL:url];

            [picker addAttachmentData:thepassdata mimeType:@"application/vnd.apple.pkpass" fileName:@"HI"];
            
            // Fill out the email body text
            NSString *emailBody = @"TEST";
            [picker setMessageBody:emailBody isHTML:NO];
            
            [self presentViewController:picker animated:YES completion:nil];
            

        }];
    }];
If I run the code to build the pass, it presents it as expected and works properly, so I know the pass data is good, I just can't figure out correct way to attach that data to the email
newtoiphonesdk is offline   0 Reply With Quote
Old Jan 27, 2013, 01:01 PM   #2
ArtOfWarfare
macrumors 603
 
ArtOfWarfare's Avatar
 
Join Date: Nov 2007
Send a message via Skype™ to ArtOfWarfare
I'm not sure I understand, what is and is not working?

Is the email composer being presented to the user as it should be?

If so, is there any attachment at all in the email?
__________________
Don't tell me Macs don't last: 2007 iMac, 2007 Mac Mini, 2008 MacBook Air, all Vintage.
(iMac obsoletion: April 28, 2015, MBA: October 14, 2015, Mac Mini: March 9, 2016)
ArtOfWarfare is offline   0 Reply With Quote
Old Jan 27, 2013, 01:23 PM   #3
newtoiphonesdk
Thread Starter
macrumors 6502a
 
Join Date: Jul 2010
Quote:
Originally Posted by ArtOfWarfare View Post
I'm not sure I understand, what is and is not working?

Is the email composer being presented to the user as it should be?

If so, is there any attachment at all in the email?
The composer shows up, but nothing gets attached to it. Apparently there is no way to attach a pkpass to email from within an app.
newtoiphonesdk is offline   0 Reply With Quote

Reply
MacRumors Forums > Apple Systems and Services > Programming > iPhone/iPad Programming

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Similar Threads
thread Thread Starter Forum Replies Last Post
iPhone: Attach to email BullittMustang Jailbreaks and iOS Hacks 10 Jan 15, 2014 08:46 PM
Mail: attach a note to an email in inbox? james*b Mac Applications and Mac App Store 0 Jan 3, 2014 02:56 AM
How to attach email message to photos pennshaq Mac Basics and Help 1 Jun 1, 2013 04:08 PM
What app can u use to download PDF files from where u can attach to email? piatti iPhone 5 Apr 18, 2013 10:57 AM
How to attach video to email ? interinfo iPad 0 Aug 29, 2012 05:19 AM

Forum Jump

All times are GMT -5. The time now is 06:25 AM.

Mac Rumors | Mac | iPhone | iPhone Game Reviews | iPhone Apps

Mobile Version | Fixed | Fluid | Fluid HD
Copyright 2002-2013, MacRumors.com, LLC