Search Results

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

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

  • Load HTML NSString into a UIWebView

    - by ehenrik
    Im doing a project where I connect to a webpage using the NSURLConnection to be able to monitor the status codes that are returned (200 OK / 404 ERROR). I would like to send the user to the top url www.domain.com if I recieve 404 as status code and if i recieve as 200 status code I would like to load the page in to a webview. I have seen several implementations of this problem by creating a new request but I feel that it is unnecessary since you already received the html in the first request so i would just like to load that HTML in to the webView. So i try to use the [webView loadHTMLFromString: baseURL:] but it doesn't always work, I have noticed that when i print the NSString with html in the connectionDidFinnishLoading it sometimes is null and when I monitor these cases by printing the html in didReceiveData a random number of the last packets is NULL (differs between 2-10). It is always the same webpages that doesn't get loaded. If I load them to my webView using [webView loadRequest:myRequest] it always works. My implementation looks like this perhaps someone of you can see what Im doing wrong. I create my first request with a button click. -(IBAction)buttonClick:(id)sender { NSURL *url = [NSURL URLWithString:@"http://www.domain.com/page2/apa.html"]; NSURLRequest *theRequest = [NSURLRequest requestWithURL:url] NSURLConnection *theConnection = [[NSURLConnection alloc] initWithRequest:theRequest delegate:self]; if( theConnection ) { webData = [[NSMutableData data] retain]; } else { } } Then I monitor the response code in the didReceiveResponse method by casting the request to a NSHTTPURLResponse to be able to access the status codes and then setting a Bool depending on the status code. -(void)connection:(NSURLConnection *)connection didReceiveResponse:(NSURLResponse *)response { NSHTTPURLResponse *ne = (NSHTTPURLResponse *)response; if ([ne statusCode] == 200){ ok = TRUE; } [webData setLength: 0]; } I then check the bools value in connectionDidFinnishLoading. If I log the html NSString I get the source of the webpage so i know that it isn't an empty string. -(void)connectionDidFinishLoading:(NSURLConnection *)connection { NSString *html = [[NSString alloc] initWithBytes: [webData mutableBytes] length:[webData length] encoding:NSUTF8StringEncoding]; NSURL *url = [NSURL URLWithString:@"http://www.domain.com/"]; if (ok){ [webView loadHTMLString:html baseURL:url]; ok = FALSE; } else{ //Create a new request to www.domain.com } } webData is an instance variable and I load it in didReceiveData like this. -(void)connection:(NSURLConnection *)connection didReceiveData:(NSData *)data { [webData appendData:data]; }

    Read the article

  • post image and other data using mulipart form data in iphone

    - by abdulsamad
    Hi all I am sending some data and and an image to the server using multipart/form-data in objective C. kindly give me some Php code that how can i save the image on the server i am able to get the other variables on the server that i am passing with the image. kindly see my obj C code and php and tell me where i am wrong. your help will be highly appreciated. here i make the POST request. ////////////////////// NSString *stringBoundary, *contentType, *baseURLString, *urlString; NSData *imageData; NSURL *url; NSMutableURLRequest *urlRequest; NSMutableData *postBody; // Create POST request from message, imageData, username and password baseURLString = @"http://localhost:8888/Test.php"; urlString = [NSString stringWithFormat:@"%@", baseURLString]; url = [NSURL URLWithString:urlString]; urlRequest = [[[NSMutableURLRequest alloc] initWithURL:url] autorelease]; [urlRequest setHTTPMethod:@"POST"]; // Set the params NSString *path = [[NSBundle mainBundle] pathForResource:@"LibraryIcon" ofType:@"png"]; imageData = [[NSData alloc] initWithContentsOfFile:path]; // Setup POST body stringBoundary = [NSString stringWithString:@"0xKhTmLbOuNdArY"]; contentType = [NSString stringWithFormat:@"multipart/form-data; boundary=%@", stringBoundary]; [urlRequest addValue:contentType forHTTPHeaderField:@"Content-Type"]; // Setting up the POST request's multipart/form-data body postBody = [NSMutableData data]; [postBody appendData:[[NSString stringWithFormat:@"\r\n\r\n--%@\r\n", stringBoundary] dataUsingEncoding:NSUTF8StringEncoding]]; [postBody appendData:[[NSString stringWithString:@"Content-Disposition: form-data; name=\"source\"\r\n\r\n"] dataUsingEncoding:NSUTF8StringEncoding]]; [postBody appendData:[[NSString stringWithString:@"lighttable"] dataUsingEncoding:NSUTF8StringEncoding]]; // So Light Table show up as source in Twitter post [postBody appendData:[[NSString stringWithFormat:@"\r\n--%@\r\n", stringBoundary] dataUsingEncoding:NSUTF8StringEncoding]]; [postBody appendData:[[NSString stringWithString:@"Content-Disposition: form-data; name=\"title\"\r\n\r\n"] dataUsingEncoding:NSUTF8StringEncoding]]; [postBody appendData:[[NSString stringWithString:book.title] dataUsingEncoding:NSUTF8StringEncoding]]; // title [postBody appendData:[[NSString stringWithFormat:@"\r\n--%@\r\n", stringBoundary] dataUsingEncoding:NSUTF8StringEncoding]]; [postBody appendData:[[NSString stringWithString:@"Content-Disposition: form-data; name=\"isbn\"\r\n\r\n"] dataUsingEncoding:NSUTF8StringEncoding]]; [postBody appendData:[[NSString stringWithString:book.isbn] dataUsingEncoding:NSUTF8StringEncoding]]; // isbn [postBody appendData:[[NSString stringWithFormat:@"\r\n--%@\r\n", stringBoundary] dataUsingEncoding:NSUTF8StringEncoding]]; [postBody appendData:[[NSString stringWithString:@"Content-Disposition: form-data; name=\"price\"\r\n\r\n"] dataUsingEncoding:NSUTF8StringEncoding]]; [postBody appendData:[[NSString stringWithString:txtPrice.text] dataUsingEncoding:NSUTF8StringEncoding]]; // Price [postBody appendData:[[NSString stringWithFormat:@"\r\n--%@\r\n", stringBoundary] dataUsingEncoding:NSUTF8StringEncoding]]; [postBody appendData:[[NSString stringWithString:@"Content-Disposition: form-data; name=\"condition\"\r\n\r\n"] dataUsingEncoding:NSUTF8StringEncoding]]; [postBody appendData:[[NSString stringWithString:txtCondition.text] dataUsingEncoding:NSUTF8StringEncoding]]; // Price NSString *imageFileName = [NSString stringWithFormat:@"photo.jpeg"]; [postBody appendData:[[NSString stringWithFormat:@"\r\n--%@\r\n", stringBoundary] dataUsingEncoding:NSUTF8StringEncoding]]; [postBody appendData:[[NSString stringWithFormat:@"Content-Disposition: form-data; name=\"upload\"; filename=\"%@\"\r\n",imageFileName] dataUsingEncoding:NSUTF8StringEncoding]]; //[postBody appendData:[[NSString stringWithFormat:@"Content-Disposition: form-data; name=\"upload\"\r\n\n\n"]dataUsingEncoding:NSUTF8StringEncoding]]; [postBody appendData:[@"Content-Type: image/jpeg\r\n\r\n" dataUsingEncoding:NSUTF8StringEncoding]]; [postBody appendData:imageData]; [postBody appendData:[[NSString stringWithFormat:@"\r\n--%@\r\n", stringBoundary] dataUsingEncoding:NSUTF8StringEncoding]]; // [postBody appendData:[[NSString stringWithFormat:@"\r\n--%@--\r\n", stringBoundary] dataUsingEncoding:NSUTF8StringEncoding]]; NSLog(@"postBody=%@", [[NSString alloc] initWithData:postBody encoding:NSASCIIStringEncoding]); [urlRequest setHTTPBody:postBody]; NSLog(@"Image data=%@",[[NSString alloc] initWithData:imageData encoding:NSASCIIStringEncoding]); // Spawn a new thread so the UI isn't blocked while we're uploading the image [NSThread detachNewThreadSelector:@selector(uploadingDataWithURLRequest:) toTarget:self withObject:urlRequest]; I the method uploadingDataWithURLRequest i post the request to the server... Here is my php Code ?php $title = $_POST['title']; $isbn = $_POST['isbn']; $price = $_POST['price']; $condition = $_POST['condition']; $image=$_FILES['image']['name']; if($image) { $filename = 'newimage.jpeg'; file_put_contents($filename, $image); echo "image is there"; } else { echo "image is nil"; } ?> I am unable to get the image on server kindly help me where i am wrong.

    Read the article

  • Compress/Decompress NSString in objective-c (iphone) using GZIP or deflate

    - by Steven
    Hi, I have a web-service running on Windows Azure which returns JSON that I consume in my iPhone app. Unfortunately, Windows Azure doesn't seem to support the compression of dynamic responses yet (long story) so I decided to get around it by returning an uncompressed JSON package, which contains a compressed (using GZIP) string. e.g {"Error":null,"IsCompressed":true,"Success":true,"Value":"vWsAAB+LCAAAAAAAB..etc.."} ... where value is the compressed string of a complex object represented in JSON. This was really easy to implement on the server, but for the life of me I can't figure out how to decompress a gzipped NSString into an uncompressed NSString, all the examples I can find for zlib etc are dealing with files etc. Can anyone give me any clues on how to do this? (I'd also be happy for a solution that used deflate as I could change the server-side implementation to use deflate too). Thanks!! Steven Edit 1: Aaah, I see that ASIHTTPRequest is using the following function in it's source code: //uncompress gzipped data with zlib + (NSData *)uncompressZippedData:(NSData*)compressedData; ... and I'm aware that I can convert NSString to NSData, so I'll see if this leads me anywhere!

    Read the article

  • UILabel + IRR, KRW and KHR currencies with wrong symbol

    - by serb
    Hi, I'm experiencing issues when converting decimal to currency for Korean Won, Cambodian Riel and Iranian Rial and showing the result to the UILabel text. Conversion itself passes just fine and I can see correct currency symbol at the debugger, even the NSLog prints the symbol well. If I assign this NSString instance to the UILabel text, the currency symbol is shown as a crossed box instead of the correct symbol. There is no other code between, does not matter what font I use. I tried to print ? (Korean Won) using the unicode value (0x20A9) or even using UTF8 representation (\xe2\x82\xa9), but all I get is the crossed box on the label. Any other supported currency in iPhone SDK and NSLocale (nearly 170 currencies) works perfectly fine no matter how exotic the currency is. Anyone else experiencing the same problem? Is there a "cure" for this? Thanks EDIT: -(NSString *)decimalToCurrency:(NSDecimalNumber *)value byLocale:(NSLocale *)locale { NSNumberFormatter *fmt = [[NSNumberFormatter alloc] init]; [fmt setLocale: locale]; [fmt setNumberStyle: NSNumberFormatterCurrencyStyle]; NSString *res = [fmt stringFromNumber: value]; [fmt release]; return res; } lbValue.text = [self decimalToCurrency: price byLocale: koreanLocale];

    Read the article

  • Objective-C Result from a Static Method saved to class instance variable giving "EXC_BAD_ACCESS" when used.

    - by KinGBin
    I am trying to store the md5 string as a class instance variable instead of the actual password. I have a static function that will return a md5 string which I'm trying to store in an instance variable instead of the actual password. I have the following setter for my class instance variable: -(void)setPassword:(NSString *)newpass{ if(newpass != password){ password = [utils md5HexDigest:newpass]; } } This will pass back the correct md5 string and save it to the password variable in my init function: [self setPassword:pword];. If I call another instance method and try to access self.password" I will get "EXC_BAD_ACCESS". I understand that the memory is getting released, but I have no clue to make sure it stays. I have tried alloc init with autorelease with no luck. This is the md5HexDigest function getting called during the init (graciously found in another stackoverflow question): + (NSString*)md5HexDigest:(NSString*)input { const char* str = [input UTF8String]; unsigned char result[CC_MD5_DIGEST_LENGTH]; CC_MD5(str, strlen(str), result); NSMutableString *ret = [NSMutableString stringWithCapacity:CC_MD5_DIGEST_LENGTH*2]; for(int i = 0; i<CC_MD5_DIGEST_LENGTH; i++) { [ret appendFormat:@"%02x",result[i]]; } return ret; } Any help/pointers would be greatly appreciated. I would rather have the md5 string saved in memory than the actual password calling the md5 every time I needed to use the password. Thanks in advance.

    Read the article

  • Check if NSString exists in custom object in NSArray

    - by Paul Peelen
    I have an NSArray with Store objects. Each Store object has two NSString objects; StoreID and Name. I would like to check quickly if an ID exists in this NSArray with Store objects. Example: Store *s1 = [[Store alloc] init]; s1.name = @"Some Name"; s1.id = @"123ABC"; Store *s2 = [[Store alloc] init]; s2.name = @"Some Other Name"; s2.id = @"ABC123"; NSArray *array = [[NSArray alloc] initWithObjects:s1, s2, nil]; NSString *myIdOne = @"ABCDEF"; NSString *myIdTwo = @"123ABC"; BOOL myIdOneExists = ...? BOOL myIdTwoExists = ...? Its the ...? I need to figure out. I know I can do this using a for loop and break when found... but this seems to me like an nasty approach since the NSArray could contain thousands of objects,... theoretically. So I would like to know about a better solution.

    Read the article

  • nsstring - out of scope

    - by alexeyndru
    -(void)loadWebAdress:(NSString*)textAdress { [UIApplication sharedApplication].networkActivityIndicatorVisible = YES; adressurl=[NSString stringWithFormat:@"http://%@", textAdress]; NSURL *url=[NSURL URLWithString:adressurl]; NSURLRequest *requestObj=[NSURLRequest requestWithURL:url]; [webview loadRequest:requestObj]; } although url takes it's value from adressurl, adressurl is all the time out of scope when checked in debugger. what is going on? i would like to use it in some other places too. not only in this method. because is out of scope, the app crashes. But, I repeat, it is the one who gives its value to url.

    Read the article

  • Load a file in a group objective-c Xcode

    - by okami
    I'd like to load a file from a specific Group in Xcode/Objective-c for example: I have TWO files named "SomeFile.txt" that are in two different folders (folders not groups yet) in the OS: SomeFolderOne |- SomeFile.txt SomeFolderTwo |- SomeFile.txt Inner Xcode I make two folders, and I put a REFERENCE to these two files: SomeGroupOne |- SomeFile.txt // this file is a reference to the SomeFile.txt from SomeFolderOne SomeGroupTwo |- SomeFile.txt // this file is a reference to the SomeFile.txt from SomeFolderTwo Now I want to read the txt content with: NSString *contents = [NSString stringWithContentsOfFile:@"SomeFile.tx" encoding:NSUTF8StringEncoding error:nil]; Ok it reads the 'SomeFile.txt' but sometimes the file read is from SomeGroupOne and sometimes the file is read from SomeGroupTwo. How to specify the group I want the file to be read?

    Read the article

  • how to extract only the 1st 2 bytes of NSString in Objective-C for iPhone programming

    - by suse
    Hello, 1) How to read the data from read stream in Objective-C, Below code would give me how many bytes are read from stream, but how to know what data is read from stream? CFIndex cf = CFReadStreameRead(Stream, buffer, length); 2) How to extract only the 1st 2bytes of NSString in Objective-C in iPhone programming. For Ex: If this is the string NSString *str = 017MacApp; 1st byte has 0 in it, and 2nd byte has 17 in it. how do i extract o and 17 into byte array? I know that the below code would give me back the byte array to int value. ((b[0] & 0xFF) << 8)+ (b[1] & 0xFF); but how to put 0 into b[0] and 17 into b[1]? plz help me to solve this.

    Read the article

  • NSString stringWithFormat: with C array?

    - by Chris Long
    Hi, I'm writing a program that calculates the Jacobi algorithm. It's written in Objective-C since it runs on a Mac, but the majority is written in standard C. I'm using a two-dimensional C array and an NSArray containing 5 NSTextField labels. The following code yields an EXC_BAD_ACCESS error: for ( int i = 0; i < 5; i++ ) { NSString *resultString = [NSString stringWithFormat:@"%g", matrix[i][i] ]; [[resultLabels objectAtIndex:i] setStringValue:resultString]; // error line } Any help?

    Read the article

  • One off errors with NSLog and NSString stringWithFormat

    - by David Liu
    Does anyone know why there would be one-off errors with NSLog and NSString? It works fine in 99% of my program, but for some reason this error appears in one of my model's description method: Example code: localFileId = 7; type = 2; localId = 5; NSLog(@"CachedFile localId=%d, 2=%d, localFileId=%d, type=%d, path=%@", localId, 2, localFileId, type, self.path); Example Result: CachedFile localId=5, 2=0, localFileId=2, type=7, path=(null) Notice the "0" that gets inserted in there, where it should be "2=2". This happens with NSString stringWithFormat as well.

    Read the article

  • How to create constant NSString by concatenating strings in Obj-C ?

    - by eric-morand
    Hi guys, I'm trying to instanciate a constant NSString by concatanating other NSString instances. Here is what I'm doing in my implementation file : static NSString *const MY_CONST = @"TEST"; static NSString *const MY_CONCATENATE_CONST = [NSString stringWithFormat:@"STRING %@", MY_CONST]; It leads to the following compilation error : Initializer element is not constant I suppose this is because stringWithFormat doesn't return a constant NSString, but since there is no other way to concatenate strings in Obj-C, what am I supposed to do ? Thanks for your help, Eric.

    Read the article

  • I want to convert NSString to NSDate but UIPickerView shows current date

    - by Ali
    I want to convert NSString to NSDate but UIPickerView shows current datedatePicker=[[UIDatePicker alloc]init]; datePicker.userInteractionEnabled=YES; datePicker.minuteInterval=5; NSLog(@"Date"); //////// NSString *curDate=alarmData.date; //Jan 14, 2011 11:37 NSDateFormatter *format = [[NSDateFormatter alloc] init]; [format setDateFormat:@"MMM dd, yyyy HH:mm"]; //Optionally for time zone converstions [format setTimeZone:[NSTimeZone timeZoneWithName:nil]]; NSDate *da = [format dateFromString:curDate]; [datePicker setDate:da animated:YES]; any suggestions

    Read the article

  • Global variable call working only first time

    - by Ruthy
    Hello, I defined a global variable that is called from other view and it is working first time but not following ones, it keeps with value from first call! Suppose that is a cocoa fundamental problem and variable is not properly defined according its need. Thanks for any idea to solve it. declaration: @interface TableArchiveAppDelegate : NSObject <UIAppDelegate> { NSString *varName; } @property (nonatomic, copy) NSString *varName; then related lines on .m file: @synthesize varName; -(void)test{ varName = textField.text; } and request from another view: - (void)viewDidLoad { TableArchiveAppDelegate *mainDelegate = (TableArchiveAppDelegate *)[[UIApplication sharedApplication] delegate]; name.text = mainDelegate.varName; [super viewDidLoad]; }

    Read the article

  • NSData to display as a string

    - by topace
    Hello all, this is my first post. I am building an iPhone app and stuck with the following: unsigned char hashedChars[32]; CC_SHA256([inputString UTF8String], [inputString lengthOfBytesUsingEncoding:NSASCIIStringEncoding], hashedChars); NSData *hashedData = [NSData dataWithBytes:hashedChars length:32]; NSLog(@"hashedData = %@", hashedData); The log is showing like: hashedData = <abcdefgh abcdefgh abcdefgh abcdefgh abcdefgh abcdefgh abcdefgh abcdefgh> But what I need is to convert hashedData into NSString that looks like: NSString *someString = @"abcdefghabcdefghabcdefghabcdefghabcdefghabcdefghabcdefghabcdefgh"; So basically the string needs to be like hashedData except I don't want the angle brackets and spaces in between. Any help is much appreciated.

    Read the article

  • [IPhone] How to get the lenth of each line of the text when wordwrap is considered.

    - by semix
    Hi there. I meet a problem as follows: I have a NSString displayed in a UILabel into multiple lines with WordWrap mode = UILineBreakModeWordWrap, rendered into 2 lines NSString* myText = @"I am here Work". "I am here_" //Line 1. _ is for blank. "Work" //Line 2. Is there anyway for me to get the width for the substring 'I am here'? and also for 2nd line 'Work' If that's hard, How can I know which part of the whole string is in line 1? and which part is in line 2? thanks in advance.

    Read the article

  • how to solve ran time error NSString, sqlite3_column_text NULL problem?

    - by Ajeet Kumar Yadav
    I am new in iphone application developer i am using sqlite3 database and in app delegate i am wright following code and run properly we also find value from database to in my aplication, but immediately the application is going to crass why this is occurs i am not understand. code is given bellow -(void)Data { databaseName = @"dataa.sqlite"; NSArray *documentPaths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES); NSString *documentsDir = [documentPaths objectAtIndex:0]; databasePath =[documentsDir stringByAppendingPathComponent:databaseName]; [self checkAndCreateDatabase]; list1 = [[NSMutableArray alloc] init]; sqlite3 *database; if (sqlite3_open([databasePath UTF8String], &database) == SQLITE_OK) { if(detailStmt == nil) { const char *sql = "Select * from Dataa"; if(sqlite3_prepare_v2(database, sql, -1, &detailStmt, NULL) == SQLITE_OK) { //NSLog(@"Hiiiiiii"); //sqlite3_bind_text(detailStmt, 1, [t1 UTF8String], -1, SQLITE_TRANSIENT); //sqlite3_bind_text(detailStmt, 2, [t2 UTF8String], -2, SQLITE_TRANSIENT); //sqlite3_bind_int(detailStmt, 3, t3); while(sqlite3_step(detailStmt) == SQLITE_ROW) { //NSLog(@"Helllloooooo"); NSString *item= [NSString stringWithUTF8String:(char *)sqlite3_column_text(detailStmt, 0)]; //NSString *fame= [NSString stringWithUTF8String:(char *)sqlite3_column_text(detailStmt, 1)]; //NSString *cinemax = [NSString stringWithUTF8String:(char *)sqlite3_column_text(detailStmt, 2)]; //NSString *big= [NSString stringWithUTF8String:(char *)sqlite3_column_text(detailStmt, 3)]; //pvr1 = pvr; item1=item; //NSLog(@"%@",item1); data = [[NSMutableArray alloc] init]; list *animal=[[list alloc] initWithName:item1]; // Add the animal object to the animals Array [list1 addObject:animal]; //[list1 addObject:item]; } sqlite3_reset(detailStmt); } sqlite3_finalize(detailStmt); // sqlite3_clear_bindings(detailStmt); } } detailStmt = nil; sqlite3_close(database); } when we see console they show the following error giving bellow 2010-03-09 10:02:40.262 SanjeevKapoor[430:20b] *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '*** +[NSString stringWithUTF8String:]: NULL cString' when we see debugger they show error in following line NSString *item= [NSString stringWithUTF8String:(char *)sqlite3_column_text(detailStmt, 0)]; I am not able to solve that problum plz help me.

    Read the article

  • Memory leak when declaring NSString from ABRecordCopyValue

    - by Ben Thompson
    I am using the following line of code... NSString *clientFirstName = (NSString *)ABRecordCopyValue(person, kABPersonFirstNameProperty); The 'analyse' feature on Xcode is saying that this giving rise to a potential memory leak. I am not releasing clientFirstName at all as I have neither alloc or retain'd it. However, I am conscious that ABRecordCopyValue may not be returning an object as say a command like [NSMutableArray arrayWithArray:someArray] would which might mean I am indeed creating a new object that I control and must release. Keen to hear thoughts...

    Read the article

  • How to release a string created inside a method in iphone?

    - by Warrior
    I have declared a local string inside the method.I am releasing the string inside the same method.I found my code crashing if release that object.If i dont release the string,code runs successfully.I have called that method in viewdidappear so that method is called while pushing and poping.Nothing gets printed in the console. Here is my code -(void)appendString{ NSString *locStr = [[NSString alloc] initWithString:@""]; for (int i=0;i<[result count]; i++) { locStr=[locStr stringByAppendingFormat:@"%@",[result objectAtIndex:i]]; } [str setString:locStr]; [locStr release]; } I am calling the "appendString" method from "viewDidAppear"."str" is a NSMutable string declared in .h class.How should i release the "locStr" .Please help me out

    Read the article

  • NSString potential 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: Potential leak on object allocated on line ... and stored into contactEmail. Is there any error on that line? UPDATE I get the same 'warning' with this line of code: ABMultiValueRef emailInfo = ABRecordCopyValue(person, kABPersonEmailProperty); But here, I can't do this: [emailInfo release]; I'm developing for iPhone.

    Read the article

  • NSString inheritance

    - by Stef
    Hi, I'm doing an useless thing for my first step in Obj-C @interface String : NSString { int m_isnull; } - (id) init; - (int) isNull; @end @implementation String - (id) init { self = [super init]; m_isnull=1; return self; } - (int) isNull { return m_isnull; } @end test : String *a; a=@"ok"; Works fine, but just 2 little questions 1) When I'm compiling I have this warning warning: incompatible Objective-C types assigning 'struct NSString *', expected 'struct String *' I don't know how to avoid it !? 2) a=@"ok" is a fastest way to initialize a string, but when I'm debugging, I don't stop by at my init constructor why ?

    Read the article

  • How does one find a '.' in a string object in Object-C

    - by NaZer
    I am working on getting a simple calculator working as part of my adventure to learning Object-C and iOS development. In Object-C using NSString, how does one look for a period in a string? Based on the comments this is what I got so far. NSString * tmp = [display text]; NSLog(@"%@", tmp); // Shows the number on the display correctly int x = [tmp rangeOfString:@"."].location; NSLog(@"%i", x); // Shows some random signed number if (x < 0) { [display setText:[[display text] stringByAppendingFormat:@"."]]; } It is still not working :(

    Read the article

  • How to read file.xml from resources to NSString with format?

    - by falkon
    Actually I have such a code: NSString *path = [[NSBundle mainBundle] pathForResource: @"connect" ofType: @"xml"]; NSError *error = nil; NSString *data = [NSString stringWithContentsOfFile: path encoding: NSUTF8StringEncoding error: &error]; NSString *message = [NSString stringWithFormat:data, KEY, COUNTRY_ID]; which reads the connect.xml from resources. But on the formating the string (message) APP quits without displaying any errors. How can I read file.xml from resources to NSString with format?

    Read the article

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