views:

23

answers:

1

i am sending the data taken from the database into the mail composer.

i have taken the data into a array from database and i have converted it into string but when i am adding the data in to mail composer it is coming in random number .

here is the code that am using to add the array taken from data base into string and then adding to mail body.

NSString *arr1 =[[appDelegate.list1 UTF8String] componentsJoinedByString:@","];


[picker setMessageBody:arr1  isHTML:NO];

if any one have the answer pls give me.

A: 
[[appDelegate.list1 UTF8String] componentsJoinedByString:@","];

What do you want here? If list1 is an array it won't response to -UTF8String, and if it is a string, the method will return a const char* which is not an Objective-C object and thus will crash on -componentsJoinedByString:.

Either use

NSString *arr1 = appDelegate.list1; // if it is a string

or

// if it is an array.
NSString *arr1 = [appDelegate.list1 componentsJoinedByString:@","];
KennyTM
list1 is array , i am using the your second option but i am getting the random number in mail composer.how can i use UTF8String for array.
uttam
@uttam: NSString is encoding agnostic, the encoding won't affect how the composer show stuff. If you see random number the other parts of the code are wrong.
KennyTM