Search Results

Search found 2356 results on 95 pages for 'nsstring'.

Page 7/95 | < Previous Page | 3 4 5 6 7 8 9 10 11 12 13 14  | Next Page >

  • Return NSString from a recursive function

    - by Dave
    Hi, I have a recursive function that is designed to take parse a tree and store all the values of the tree nodes in an NSString. Is the algorithm below correct? NSString* finalString = [self parseTree:rootNode string:@""]; -(NSString*)parseTree:(Node*)currentNode string:(NSMutableString*)myString { [myString appendText:currentNode.value]; for(int i=0;i<[currentNode.children length];i++){ return [self parseTree:[currentNode.children] objectAtIndex:i] string:myString]; } }

    Read the article

  • What is the difference between these two ways of creating NSStrings?

    - by adame
    NSString *myString = @"Hello"; NSString *myString = [NSString stringWithString:@"Hello"]; I understand that using method (1) creates a pointer to a string literal that is defined as static memory (and cannot be deallocated) and that using (2) creates an NSString object that will be autoreleased. Is using method (1) bad? What are the major differences? Is there any instances where you would want to use (1)? Is there a performance difference? P.S. I have searched extensively on Stack Overflow and while there are questions on the same topic, none of them have answers to the questions I have posted above.

    Read the article

  • Comparing the values of two nsstrings

    - by user1776234
    So I have been trying to compare two NSStrings in xcode. However, it is not working. What am I doing wrong? NSString Prog are characters that are xml parsed from mysql char *cStr = "YES"; NSString *str3 = [NSString stringWithUTF8String:cStr]; if ([str3 isEqualToString:prog]) { [switch1 setOn:YES animated:YES]; } else { [switch1 setOn:NO animated:YES]; }

    Read the article

  • Find Exact difference between two dates

    - by iPhone Fun
    Hi all , I want some changes in the date comparison. In my application I am comparing two dates and getting difference as number of Days, but if there is only one day difference the system shows me 0 as a difference of days. I do use following code NSDateFormatter *date_formater=[[NSDateFormatter alloc]init]; [date_formater setDateFormat:@"MMM dd,YYYY"]; NSString *now=[NSString stringWithFormat:@"%@",[date_formater stringFromDate:[NSDate date]]]; LblTodayDate.text = [NSString stringWithFormat:@"%@",[NSString stringWithFormat:@"%@",now]]; NSDate *dateofevent = [[NSUserDefaults standardUserDefaults] valueForKey:@"CeremonyDate_"]; NSDate *endDate =dateofevent; NSDate *startDate = [NSDate date]; gregorian = [[NSCalendar alloc] initWithCalendarIdentifier:NSGregorianCalendar]; unsigned int unitFlags = NSDayCalendarUnit; NSDateComponents *components = [gregorian components:unitFlags fromDate:startDate toDate:endDate options:0]; int days = [components day]; I found some solutions that If we make the time as 00:00:00 for comparision then it will show me proper answer , I am right or wrong i don't know. Please help me to solve the issue

    Read the article

  • Find out number of fraction digits in currency in iOS

    - by thejaz
    I use NSNumberFormatter to format currencies in a localized way, and it works fine. But I want to override this and give the user the option to override the number of digits after the decimal separator. How can I find out the number of digits the NSNumberFormatter will use for a certain currency? I have looked in the NSLocale object, but none of the keys tell me this. NSString * const NSLocaleIdentifier; NSString * const NSLocaleLanguageCode; NSString * const NSLocaleCountryCode; NSString * const NSLocaleScriptCode; NSString * const NSLocaleVariantCode; NSString * const NSLocaleExemplarCharacterSet; NSString * const NSLocaleCalendar; NSString * const NSLocaleCollationIdentifier; NSString * const NSLocaleUsesMetricSystem; NSString * const NSLocaleMeasurementSystem; NSString * const NSLocaleDecimalSeparator; NSString * const NSLocaleGroupingSeparator; NSString * const NSLocaleCurrencySymbol; NSString * const NSLocaleCurrencyCode; NSString * const NSLocaleCollatorIdentifier; NSString * const NSLocaleQuotationBeginDelimiterKey; NSString * const NSLocaleQuotationEndDelimiterKey; NSString * const NSLocaleAlternateQuotationBeginDelimiterKey; NSString * const NSLocaleAlternateQuotationEndDelimiterKey; How can I find out the correct number of decimals for a currency like the NSNumberFormatter seems to know?

    Read the article

  • Objective C: Function returning correct data for the first time of call and null for other times

    - by Kooshal Bhungy
    Hi all, Am a beginner in objective C, i am implementing a function that would query a web server and display the returning string in console. I am calling the function (getDatafromServer) repeatedly in a loop. The problem is that the first time am getting the value whereas the other times, it returns me a (null) in console... I've searched about memory management and check out on the forums but none have worked. Can you please guys tell me where am wrong in the codes below? Thanks in advance.... @implementation RequestThread +(void)startthread:(id)param{ while (true) { //NSLog(@"Test threads"); sleep(5); NSLog(@"%@",[self getDatafromServer]); } } +(NSString *) getDatafromServer{ NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init]; NSString *myRequestString = @"name=Hello%20&[email protected]"; NSData *myRequestData = [NSData dataWithBytes:[myRequestString UTF8String] length:[myRequestString length]]; NSMutableURLRequest *request = [[NSMutableURLRequest alloc] initWithURL: [NSURL URLWithString:@"http://192.168.1.32/gs/includes/widget/getcalls.php?user=asdasd&passw=asdasdasd"]]; [request setHTTPMethod:@"POST"]; [request setHTTPBody: myRequestData]; [request setValue:@"application/x-www-form-urlencoded" forHTTPHeaderField:@"content-type"]; NSData *returnData = [NSURLConnection sendSynchronousRequest:request returningResponse:nil error:nil]; NSString *myString = [NSString stringWithUTF8String:[returnData bytes]]; [myRequestString release]; [request release]; [returnData release]; return myString; [pool release]; } @end

    Read the article

  • Getting sync(uploading) multipale data on the remote server from iphone

    - by Ajay
    i am try to sync or upload the data on the remote server from iphone but not getting it.I try this from 1 week but didn't success how can solve this .I am using the NSURLConnection methods or any one give idea on ASIHTTPRequest method but i am new for *ASIHTTPReques*t .I need this method only .For this code like this -(void)sendRequestforContent { //this for finding the date of sync on the server NSDate* date = [NSDate date]; //Create the dateformatter object NSDateFormatter* formatter = [[[NSDateFormatter alloc] init] autorelease]; //Set the required date format [formatter setDateFormat:@"dd-MMM-yyyy"]; //Get the string date NSString* str = [formatter stringFromDate:date]; NSError *error = nil; NSHTTPURLResponse *response = nil; NSMutableData *postBody = [NSMutableData data]; NSURL *url = [NSURL URLWithString:@"http://www.google.com"]; NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:url]; NSString *boundary = @"-------------------a9d8vyb89089dy70"; NSString *contentType = [NSString stringWithFormat:@"multipart/form-data; boundary=%@", boundary]; [request setHTTPMethod:@"POST"]; [request setValue:contentType forHTTPHeaderField:@"Content-Type"]; [postBody appendData:[[NSString stringWithFormat:@"--%@\r\n", boundary] dataUsingEncoding:NSUTF8StringEncoding]]; //this is for TOKEN_API [postBody appendData:[@"Content-disposition: form-data; name=\"Token\"\r\n\r\n" dataUsingEncoding:NSUTF8StringEncoding]]; [postBody appendData:[tokenapi dataUsingEncoding:NSUTF8StringEncoding]]; [postBody appendData:[[NSString stringWithFormat:@"\r\n--%@\r\n", boundary] dataUsingEncoding:NSUTF8StringEncoding]]; //this for the CONTENT_ID [postBody appendData:[@"Content-disposition: form-data; name=\"contentID\"\r\n\r\n" dataUsingEncoding:NSUTF8StringEncoding]]; [postBody appendData:[content_id dataUsingEncoding:NSUTF8StringEncoding]]; [postBody appendData:[[NSString stringWithFormat:@"\r\n--%@\r\n", boundary] dataUsingEncoding:NSUTF8StringEncoding]]; //this for the CONTENTTYPE_ID [postBody appendData:[@"Content-disposition: form-data; name=\"contentTypeID\"\r\n\r\n" dataUsingEncoding:NSUTF8StringEncoding]]; NSString *ContentTypeString = [NSString stringWithFormat:@"%d",content_type]; [postBody appendData:[ContentTypeString dataUsingEncoding:NSUTF8StringEncoding]]; [postBody appendData:[[NSString stringWithFormat:@"\r\n--%@\r\n", boundary] dataUsingEncoding:NSUTF8StringEncoding]]; //this for the CONTENT_Location_Id [postBody appendData:[@"Content-disposition: form-data; name=\"contentLocationID\"\r\n\r\n" dataUsingEncoding:NSUTF8StringEncoding]]; [postBody appendData:[contenLocation_id dataUsingEncoding:NSUTF8StringEncoding]]; [postBody appendData:[[NSString stringWithFormat:@"\r\n--%@\r\n", boundary] dataUsingEncoding:NSUTF8StringEncoding]]; //this is for the User_Caption [postBody appendData:[@"Content-disposition: form-data; name=\"userCaption\"\r\n\r\n" dataUsingEncoding:NSUTF8StringEncoding]]; [postBody appendData:[user_caption dataUsingEncoding:NSUTF8StringEncoding]]; [postBody appendData:[[NSString stringWithFormat:@"\r\n--%@\r\n", boundary] dataUsingEncoding:NSUTF8StringEncoding]]; //this is for the User_Comment [postBody appendData:[@"Content-disposition: form-data; name=\"userComment\"\r\n\r\n" dataUsingEncoding:NSUTF8StringEncoding]]; [postBody appendData:[user_comment dataUsingEncoding:NSUTF8StringEncoding]]; [postBody appendData:[[NSString stringWithFormat:@"\r\n--%@\r\n", boundary] dataUsingEncoding:NSUTF8StringEncoding]]; //this for the Tags [postBody appendData:[@"Content-disposition: form-data; name=\"tags\"\r\n\r\n" dataUsingEncoding:NSUTF8StringEncoding]]; [postBody appendData:[tag dataUsingEncoding:NSUTF8StringEncoding]]; [postBody appendData:[[NSString stringWithFormat:@"\r\n--%@\r\n", boundary] dataUsingEncoding:NSUTF8StringEncoding]]; //this for the Date_Record [postBody appendData:[@"Content-disposition: form-data; name=\"dateRecorded\"\r\n\r\n" dataUsingEncoding:NSUTF8StringEncoding]]; [postBody appendData:[date_recorded dataUsingEncoding:NSUTF8StringEncoding]]; [postBody appendData:[[NSString stringWithFormat:@"\r\n--%@\r\n", boundary] dataUsingEncoding:NSUTF8StringEncoding]]; //this for the image_data [postBody appendData:[[NSString stringWithFormat:@"Content-disposition: form-data; name=\"image_file\"; filename=\"%@\"\r\n",@"image.jpg"] dataUsingEncoding:NSUTF8StringEncoding]]; [postBody appendData:[@"Content-Type: image/jpg\r\n\r\n" dataUsingEncoding:NSUTF8StringEncoding]]; [postBody appendData:image]; [postBody appendData:[[NSString stringWithFormat:@"\r\n--%@--\r\n",boundary] dataUsingEncoding:NSUTF8StringEncoding]]; //this for the Share_type [postBody appendData:[@"Content-disposition: form-data; name=\"shareType\"\r\n\r\n" dataUsingEncoding:NSUTF8StringEncoding]]; NSString *ShareString = [NSString stringWithFormat:@"%d",share_type]; [postBody appendData:[ShareString dataUsingEncoding:NSUTF8StringEncoding]]; [postBody appendData:[[NSString stringWithFormat:@"\r\n--%@\r\n", boundary] dataUsingEncoding:NSUTF8StringEncoding]]; //this for the Views [postBody appendData:[@"Content-disposition: form-data; name=\"views\"\r\n\r\n" dataUsingEncoding:NSUTF8StringEncoding]]; NSString *ViewsString = [NSString stringWithFormat:@"%d",views]; [postBody appendData:[ViewsString dataUsingEncoding:NSUTF8StringEncoding]]; [postBody appendData:[[NSString stringWithFormat:@"\r\n--%@\r\n", boundary] dataUsingEncoding:NSUTF8StringEncoding]]; //this for the PLAY_time [postBody appendData:[@"Content-disposition: form-data; name=\"playTime\"\r\n\r\n" dataUsingEncoding:NSUTF8StringEncoding]]; NSString *TimeString = [NSString stringWithFormat:@"%d",play_time]; [postBody appendData:[TimeString dataUsingEncoding:NSUTF8StringEncoding]]; [postBody appendData:[[NSString stringWithFormat:@"\r\n--%@\r\n", boundary] dataUsingEncoding:NSUTF8StringEncoding]]; //this for the Posted_By [postBody appendData:[@"Content-disposition: form-data; name=\"postedBy\"\r\n\r\n" dataUsingEncoding:NSUTF8StringEncoding]]; [postBody appendData:[postred_by dataUsingEncoding:NSUTF8StringEncoding]]; //this for the AVG_Rating [postBody appendData:[[NSString stringWithFormat:@"\r\n--%@\r\n", boundary] dataUsingEncoding:NSUTF8StringEncoding]]; [postBody appendData:[@"Content-disposition: form-data; name=\"avgRating\"\r\n\r\n" dataUsingEncoding:NSUTF8StringEncoding]]; NSString *AvgString = [NSString stringWithFormat:@"%d",avg_rating]; [postBody appendData:[AvgString dataUsingEncoding:NSUTF8StringEncoding]]; [postBody appendData:[[NSString stringWithFormat:@"\r\n--%@\r\n", boundary] dataUsingEncoding:NSUTF8StringEncoding]]; [postBody appendData:[@"Content-disposition: form-data; name=\"LastSyncDate\"\r\n\r\n" dataUsingEncoding:NSUTF8StringEncoding]]; [postBody appendData:[str dataUsingEncoding:NSUTF8StringEncoding]]; [postBody appendData:[[NSString stringWithFormat:@"\r\n--%@\r\n", boundary] dataUsingEncoding:NSUTF8StringEncoding]]; [request setHTTPBody:postBody]; NSData *shoutData = [NSURLConnection sendSynchronousRequest:request returningResponse:&response error:&error]; NSString *returnString = [[NSString alloc] initWithData:shoutData encoding:NSUTF8StringEncoding]; NSLog(@"%@",returnString); } it is not going into the this mthods -(void)connectionDidFinishLoading:(NSURLConnection *)connection { loginStatus = [[NSString alloc] initWithBytes: [webData mutableBytes] length:[webData length] encoding:NSUTF8StringEncoding]; NSLog(@"%@",loginStatus); } It show me html page on console I hope people help me to solve it out

    Read the article

  • NSString to NSData Failing in Encoding

    - by Travis
    I'm trying to use NSXmlParser to parse ISO-8859-1 data. Using Apple's own example for parsing ISO-8859-1, I have the following. NSString *xmlFilePath = [[NSBundle mainBundle] pathForResource:sampleFileName ofType:@"xml"]; NSString *xmlFileContents = [NSString stringWithContentsOfFile:xmlFilePath encoding:NSISOLatin1StringEncoding error:nil]; NSLog(@"contents: %@", xmlFileContents); I see that in the console, the contents of the string is accurate. However when I try to convert it to an NSData object (for use with the parser), I do the following. NSData *xmlData = [xmlFileContents dataUsingEncoding:NSISOLatin1StringEncoding]; But then when my didStartElement delegate gets called, I see  showing up which I think is from an encoding discrepancy. Can NSXmlParser handle ISO-8859-1 and if so, what am I doing wrong?

    Read the article

  • NSString not applying to UILabel

    - by lyonjtill
    - (void)restoreUserDefaults { NSUserDefaults *defaults = [NSUserDefaults standardUserDefaults]; if([defaults objectForKey:@"Exam Name"] == nil) { examName = [[NSString alloc] initWithString:@"Name"]; } else { examName = [[NSString alloc] initWithString:[defaults objectForKey:@"Exam Name"]]; } [examNameLabel setText:examName]; NSLog(@"New Exam Schedule - Exam Name - %@",[defaults objectForKey:@"Exam Name"]); NSLog(@"examName = %@", examName); NSLog(@"examNameLabel = %@", examNameLabel); } Dear all, Basically above is a basic method to change a UILabel to a saved piece of data. I am having a problem making the label change to the NSString examName. I have checked Interface Builder and it's connected up. Any ideas why? Regards Lyon J Till

    Read the article

  • How do I write an IF ELSE to check string contents of an array?

    - by Michael Robinson
    I'm trying to write an IF ELSE statement to enable shipping, If user doesn't add an address the array contents remain as "-" & "-" for the two items in the array. I want to check to see if those are in the array, if they are then I want to enableshipping. Here is the code for getting the array: NSArray *paths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES); NSString *documentsDirectory = [paths objectAtIndex:0]; NSString *fullFileName = [NSString stringWithFormat:@"%@/arraySaveFile", documentsDirectory]; NSMutableArray *array = [[NSMutableArray alloc] initWithContentsOfFile:fullFileName]; How do I write this first line to look for the "-" & "-"? if ([fullFileName isEqualToString:@"-","-"]) { [nnNEP EnableShipping]; } else { [nnNEP DisableShipping]; } Thanks, michael

    Read the article

  • How do I add a space between two concatenated NSStrings?

    - by ChrisR
    I have three string objects: NSString *firstName; NSString *lastName; NSString *fullName; The values for firstName and lastName are received from NSTextFields. I then want to concatenate the two strings and place the result in fullname. This is the code that I'm using: fullName = [firstName stringByAppendingString:lastName]; However, the result does not put a space between the two names (e.g. JohnSmith). How do I add in the space? I'd like the result to look like (John Smith).

    Read the article

  • UIWebview contents as NSString from HTML

    - by Yoon Lee
    I'm trying to reading part of HTML source code from website that has been encapsulated by javascript;basically i'm trying to read email which appears in webview but not in real source code using NSString method of 'NSString stringWithContentsOfURL:(NSURL *)url'. it looks like code showing up before hitting up the inner java script (which executes and shows the email address to show). are there any way i can get into NSString the contents that I viewed over UIWebview? I tried to use the method 'webView stringByEvaluatingJavaScriptFromString' it worked for only displaying through webview browser didn't return any string value. Are there anyway I can get the string?

    Read the article

  • How to remove all of the html whitespace/newlines of a NSString

    - by Kyriakos Leivadas
    i've got a problem and i hope someone can solve it. I parsed some html to a nsstring and im trying to trim all of the characters and keep some specific words. The problem is that i trimmed all the characters from the nsstring that i didnt want but the weird thing is that i cant get rid of all the whitespace. i used all the techniques i read from other answers but still some whitespace remains. here is my code -(void)requestFinished:(ASIHTTPRequest *)request{ NSString *htmlData = [request responseString]; NSCharacterSet *garbage = [NSCharacterSet characterSetWithCharactersInString:@"qazwsxedcrfvtgbyhnujmik,ol.p;/[]'QAZWSXEDCRFVTGBYHNUJMIKOLP()\"-1234567890#{}=:+_&!`<>"]; //im doing this to remove all characters except non-english chars htmlData = [htmlData compomentsSeparatedByCharactersInSet:garbage ]compomentsJoinedByString:@""]; htmlData = [htmlData stringByTrimmingCharactersInSet:[NSCharacterSet whitespaceAndNewlineCharacterSet]]; htmlData = [htmlData stringByReplacingOccurencesOfString:@"[\n\t\r ]+" withString@""]; htmlData = [htmlData stringByReplacingOccurencesOfString:@" " withString:@""]; NSLog(@"%@",htmlData); } i get this result: nonenglishwordsnonenglishwords nonenglishwordsnonenglishwords (whitespace or new lines in middle remains) thank you.

    Read the article

  • UTF8 from web conten .xml file to NSString

    - by mongeta
    Hello, I can't find a way to convert some UTF8 encoding into NSString. I get some data from a URL, it's a .xml file and here is their content: <?xml version="1.0" encoding="UTF-8"?> <person> <name>Jim Fern&#225;ndez</name> <phone>555-1234</phone> </person> How I can convert the á into a á ? some code that doesn't work: NSString* newStr = [[NSString alloc] initWithData:[NSData dataWithContentsOfURL:URL] encoding:NSUTF8StringEncoding];

    Read the article

  • How to extract the actual NSString from json object as NSArray

    - by Toran Billups
    I'm working with a large set of json and really just need the NSString representation of what's inside the NSArray -including all the { } My question is this - is their a better way than simply looping through each NSArray inside the main NSArray and outputting the description one by one? ie- the below is a start to this process but it's very brittle meaning I need to know each item inside the hat {} and this isn't something I actually care about. I just need the json string to move forward. The working code is below (thank you in advance!) NSString* responseString = [[NSString alloc] initWithData:responseData encoding:NSUTF8StringEncoding]; [responseData release]; NSArray* json = [responseString JSONValue]; NSArray* item = [json valueForKeyPath:@"d.data"]; NSArray* hatjson = [item objectForKey:@"hat"]; NSMutableString * result = [[NSMutableString alloc] init]; for (NSObject * obj in hatjson) { [result appendString:[obj description]]; } NSLog(@"the hat json is .. %@", result);

    Read the article

  • Prevent printing -0

    - by fishinear
    If I do the following in Objective-C: NSString *result = [NSString stringWithFormat:@"%1.1f", -0.01]; It will give result @"-0.0" Does anybody know how I can force a result @"0.0" (without the "-") in this case? EDIT: I tried using NSNumberFormatter, but it has the same issue. The following also produces @"-0.0": double value = -0.01; NSNumberFormatter *numberFormatter = [[NSNumberFormatter alloc] init]; [numberFormatter setNumberStyle:NSNumberFormatterDecimalStyle]; [numberFormatter setMaximumFractionDigits:1]; [numberFormatter setMinimumFractionDigits:1]; NSString *result = [numberFormatter stringFromNumber:[NSNumber numberWithDouble:value]];

    Read the article

  • NSString problem on iphone while displaying on UILabel

    - by prajakta
    i have a issue , i am asking as new question as previoes one was messed NSString *s=@"hi\nhello\n\nwelcome to this world\ni m jhon" label.frame = ...//big enough height label.numberOfLines = 0; label.text = s; this code helps me to separate string based on \n but if i do this NSString *s=Ad.content //where Ad.content value is **hi\nhello\n\nwelcome to this world\ni m jhon** label.numberOfLines = 0; label.text = s; i am not able to sperate them by \n , what i am doing wrong here kindly suggest Thanks

    Read the article

  • Converting NSMutableData to NSString Problem

    - by Sheehan Alam
    initWithData does not convert my data object into a string properly. When I check the length of the data object, it has a value. NSMutableData* receivedData =[[NSMutableData data] retain]; NSString* json_string = [[NSString alloc] initWithData:receivedData encoding:NSUTF8StringEncoding]; Am I doing something wrong creating the string?

    Read the article

  • How to convert CFStringRef to NSString?

    - by papr
    NSString *aNSString; CFStringRef aCFString; aCFString = CFStringCreateWithCString(NULL, [aNSString UTF8String], NSUTF8StringEncoding); aCFString = CFXMLCreateStringByUnescapingEntities(NULL, aCFString, NULL); How can I get a new NSString from aCFString?

    Read the article

  • NSString potencial leak

    - by VansFannel
    Hello. When I build and analyze my project on XCode, I obtain a 'warning' on the following line: NSString *contactEmail = (NSString *)ABMultiValueCopyValueAtIndex(emailInfo, 0); The message is: Potencial leak on object allocated on line ... and stored into contactEmail. Is there any error on that line?

    Read the article

  • Float Conversion Issue

    - by user1407570
    I have an issue after converted a float from a string, the result of my operation is null The NSLogs give the right value but vitesseMoyenne is equal to null -(void)setVitesseMoyenne:(float)uneDistanceTotale:(NSString*)unTempsTotal { //float tempEnFloat = [unTempsTotal floatValue]; NSLog(@"%@",unTempsTotal); float calculVitesseMoyenne = uneDistanceTotale / [unTempsTotal floatValue]; NSLog(@"%f",calculVitesseMoyenne); vitesseMoyenne = [NSString stringWithFormat:@"%f", calculVitesseMoyenne]; } Can you see what is wrong ?

    Read the article

  • objective C convert NSString to unsigned

    - by user1501354
    I have changed my question. I want to convert an NSString to an unsigned int. Why? Because I want to do parallel payment in PayPal. Below I have given my coding in which I want to convert the NSString to an unsigned int. My query is: //optional, set shippingEnabled to TRUE if you want to display shipping //options to the user, default: TRUE [PayPal getPayPalInst].shippingEnabled = TRUE; //optional, set dynamicAmountUpdateEnabled to TRUE if you want to compute //shipping and tax based on the user's address choice, default: FALSE [PayPal getPayPalInst].dynamicAmountUpdateEnabled = TRUE; //optional, choose who pays the fee, default: FEEPAYER_EACHRECEIVER [PayPal getPayPalInst].feePayer = FEEPAYER_EACHRECEIVER; //for a payment with multiple recipients, use a PayPalAdvancedPayment object PayPalAdvancedPayment *payment = [[PayPalAdvancedPayment alloc] init]; payment.paymentCurrency = @"USD"; // A payment note applied to all recipients. payment.memo = @"A Note applied to all recipients"; //receiverPaymentDetails is a list of PPReceiverPaymentDetails objects payment.receiverPaymentDetails = [NSMutableArray array]; NSArray *emailArray = [NSArray arrayWithObjects:@"[email protected]",@"[email protected]", nil]; for (int i = 1; i <= 2; i++) { PayPalReceiverPaymentDetails *details = [[PayPalReceiverPaymentDetails alloc] init]; // Customize the payment notes for one of the three recipient. if (i == 2) { details.description = [NSString stringWithFormat:@"Component %d", i]; } details.recipient = [NSString stringWithFormat:@"%@",[emailArray objectAtIndex:i-1]]; unsigned order; if (i==1) { order = [[feeArray objectAtIndex:0] unsignedIntValue]; } if (i==2) { order = [[amountArray objectAtIndex:0] unsignedIntValue]; } //subtotal of all items for this recipient, without tax and shipping details.subTotal = [NSDecimalNumber decimalNumberWithMantissa:order exponent:-4 isNegative:FALSE]; //invoiceData is a PayPalInvoiceData object which contains tax, shipping, and a list of PayPalInvoiceItem objects details.invoiceData = [[PayPalInvoiceData alloc] init]; //invoiceItems is a list of PayPalInvoiceItem objects //NOTE: sum of totalPrice for all items must equal details.subTotal //NOTE: example only shows a single item, but you can have more than one details.invoiceData.invoiceItems = [NSMutableArray array]; PayPalInvoiceItem *item = [[PayPalInvoiceItem alloc] init]; item.totalPrice = details.subTotal; [details.invoiceData.invoiceItems addObject:item]; [payment.receiverPaymentDetails addObject:details]; } [[PayPal getPayPalInst] advancedCheckoutWithPayment:payment]; Can anybody tell me how to do this conversion? Thanks and regards in advance.

    Read the article

  • Sending array through email on iphone

    - by thary
    Hey guys I need to send the content of an NSMutableArray through email. I have a mailing function but I'm not sure on how to place the content of the array into a NSString to be displayed on the email under each other. Is there a way to place all the content of the array into the string with maybe HTML nextline command between each array element? NSString *emailBody = @"Need to put the body here"; Thanks

    Read the article

< Previous Page | 3 4 5 6 7 8 9 10 11 12 13 14  | Next Page >