ios - How to retrieve the .xml extension attachments from mail by using MailCore to Sample iPhone app -
how retrieve .xml extension attachments mail using mailcore iphone?
i used mailcore download attachments mail sample iphone app. getting inbox subjects mail subjects sort particular mail subject , mail attachments.
the problem got particular mail subject not attachments. used below code attachments mail it's not working.
nsarray *array=[msg attachments]; ctbareattachment *ctbaratt=[array objectatindex:0]; ctcoreattachment *ctcoreatt=[ctbaratt fetchfullattachment];
but i'm getting :
array count 0
please share ideas.
this few reasons:
1)it possible you're not downloading enough information ctcoremessage. when making request download ctcoremessages must specify information want specifying correct fetch attributes.
for example:
[core_folder messagesfromsequencenumber:from to:to withfetchattributes: ctfetchattrenvelope | ctfetchattrbodystructure]
should populate information attachments.
when fetching message imap, command specify information wants.
you can see being fetched enabling mailcore logging follows:
mailcoreenablelogging(); [core_folder messagesfromsequencenumber:from to:to withfetchattributes: ctfetchattrenvelope | ctfetchattrbodystructure]; mailcoredisablelogging();
you see commands of format
<command number> <uid> <command> (<requested structure>)
i imagine see this:
1 uid fetch (envelope)
you should ensure inside () either body or body[2] or rfc822 these contain information attachments.
when see being fetched can read rfc, if dealing mailcore , imap worth investment in time.
2)failing that, perhaps ctcoreaccount and/or ctcorefolder not connected, preventing ctcoremessage having valid mailimapsession , being unable download attachment information. if attribute inside ctcoremessage not available libetpan should download on request. fact not suggests account or folder may not valid or connected.
Comments
Post a Comment