iphone Programming Glossary: stringwithformat
How do I record audio on iPhone with AVAudioRecorder? http://stackoverflow.com/questions/1010343/how-do-i-record-audio-on-iphone-with-avaudiorecorder NSDate dateWithTimeIntervalSinceNow 0 NSString caldate now description recorderFilePath NSString stringWithFormat @ @ @.caf DOCUMENTS_FOLDER caldate retain NSURL url NSURL fileURLWithPath recorderFilePath err nil recorder..
How can I upload a photo to a server with the iPhone? http://stackoverflow.com/questions/125306/how-can-i-upload-a-photo-to-a-server-with-the-iphone requestWithURL url urlRequest setHTTPMethod @ POST urlRequest setValue NSString stringWithFormat @ multipart form data boundary @ boundry forHTTPHeaderField @ Content Type NSMutableData postData NSMutableData.. NSMutableData postData NSMutableData dataWithCapacity data length 512 postData appendData NSString stringWithFormat @ @ r n boundry dataUsingEncoding NSUTF8StringEncoding postData appendData NSString stringWithFormat.. @ @ r n boundry dataUsingEncoding NSUTF8StringEncoding postData appendData NSString stringWithFormat @ Content Disposition form data name @ filename file.bin r n r n FORM_FLE_INPUT dataUsingEncoding NSUTF8StringEncoding..
EXC_BAD_ACCESS signal received http://stackoverflow.com/questions/327082/exc-bad-access-signal-received if you get something back from just about anything else including factory methods e.g. NSString stringWithFormat then you'll have an autorelease reference which means it could be released at some time in the future..
Bold & Non-Bold Text In A Single UILabel? http://stackoverflow.com/questions/3586871/bold-non-bold-text-in-a-single-uilabel stringFromDate refreshDate NSString prefix NSLocalizedString @ Updated nil NSString text NSString stringWithFormat @ @ @ prefix dateString df release Create the text layer on demand if _textLayer _textLayer CATextLayer..
display image from URL retrieved from ALAsset in iPhone http://stackoverflow.com/questions/3837115/display-image-from-url-retrieved-from-alasset-in-iphone cell.imageView setImage UIImage imageWithCGImage asset thumbnail cell.textLabel setText NSString stringWithFormat @ Photo d indexPath.row 1 return cell iphone image url share improve this question The API has..
iOS UIImagePickerController result image orientation after upload http://stackoverflow.com/questions/5427656/ios-uiimagepickercontroller-result-image-orientation-after-upload post keys values request setFile UIImageJPEGRepresentation self.image 100.0f withFileName NSString stringWithFormat @ d.jpg NSDate date timeIntervalSinceNow andContentType @ image jpg forKey @ imageFile request startAsynchronous..
Locking the Fields in MFMailComposeViewController http://stackoverflow.com/questions/6284599/locking-the-fields-in-mfmailcomposeviewcontroller testMsg.validateSSLChain NO testMsg.delegate self email contents NSString bodyMessage NSString stringWithFormat @ This is the body of the email. You can put anything in here that you want. NSDictionary plainPart..
Objective C HTML escape/unescape http://stackoverflow.com/questions/659602/objective-c-html-escape-unescape NSString s if s nil NSLog @ ERROR Parameter string is nil NSString xmlStr NSString stringWithFormat @ d @ d s NSData data xmlStr dataUsingEncoding NSUTF8StringEncoding allowLossyConversion YES NSXMLParser..
Has anyone implemented the PayPal API through a native iPhone app? http://stackoverflow.com/questions/779423/has-anyone-implemented-the-paypal-api-through-a-native-iphone-app perfomingSetMobileCheckout YES recordResults FALSE NSString parameterString NSString stringWithFormat @ USER @ PWD @ SIGNATURE @ VERSION 57.0 METHOD SetMobileCheckout AMT .2f CURRENCYCODE USD DESC @ RETURNURL.. NSMutableURLRequest theRequest NSMutableURLRequest requestWithURL url NSString msgLength NSString stringWithFormat @ d parameterString length theRequest addValue msgLength forHTTPHeaderField @ Content Length theRequest..
iPhone Data Usage Tracking/Monitoring http://stackoverflow.com/questions/7946699/iphone-data-usage-tracking-monitoring autorelease success getifaddrs addrs 0 if success cursor addrs while cursor NULL name NSString stringWithFormat @ s cursor ifa_name NSLog @ ifa_name s @ n cursor ifa_name name names of interfaces en0 is WiFi pdp_ip0..
Dispelling the UIImage imageNamed: FUD http://stackoverflow.com/questions/924740/dispelling-the-uiimage-imagenamed-fud NSString bundlePath NSBundle mainBundle bundlePath return UIImage imageWithContentsOfFile NSString stringWithFormat @ @ @ bundlePath aFileName Rincewind also included some example code to build your own optimised version...
File Upload to HTTP server in iphone programming http://stackoverflow.com/questions/936855/file-upload-to-http-server-in-iphone-programming @ POST NSString boundary @ 14737809831466499882746641449 NSString contentType NSString stringWithFormat @ multipart form data boundary @ boundary request addValue contentType forHTTPHeaderField @ Content.. @ Content Type NSMutableData postbody NSMutableData data postbody appendData NSString stringWithFormat @ r n @ r n boundary dataUsingEncoding NSUTF8StringEncoding postbody appendData NSString stringWithFormat.. @ r n @ r n boundary dataUsingEncoding NSUTF8StringEncoding postbody appendData NSString stringWithFormat @ Content Disposition form data name userfile filename @.jpg r n filename dataUsingEncoding NSUTF8StringEncoding..
How do I record audio on iPhone with AVAudioRecorder? http://stackoverflow.com/questions/1010343/how-do-i-record-audio-on-iphone-with-avaudiorecorder AVLinearPCMIsFloatKey Create a new dated file NSDate now NSDate dateWithTimeIntervalSinceNow 0 NSString caldate now description recorderFilePath NSString stringWithFormat @ @ @.caf DOCUMENTS_FOLDER caldate retain NSURL url NSURL fileURLWithPath recorderFilePath err nil recorder AVAudioRecorder alloc initWithURL url settings recordSetting..
How can I upload a photo to a server with the iPhone? http://stackoverflow.com/questions/125306/how-can-i-upload-a-photo-to-a-server-with-the-iphone index.pl HTTPFileUpload NSMutableURLRequest urlRequest NSMutableURLRequest requestWithURL url urlRequest setHTTPMethod @ POST urlRequest setValue NSString stringWithFormat @ multipart form data boundary @ boundry forHTTPHeaderField @ Content Type NSMutableData postData NSMutableData dataWithCapacity data length 512 postData appendData.. data boundary @ boundry forHTTPHeaderField @ Content Type NSMutableData postData NSMutableData dataWithCapacity data length 512 postData appendData NSString stringWithFormat @ @ r n boundry dataUsingEncoding NSUTF8StringEncoding postData appendData NSString stringWithFormat @ Content Disposition form data name @ filename file.bin r.. data length 512 postData appendData NSString stringWithFormat @ @ r n boundry dataUsingEncoding NSUTF8StringEncoding postData appendData NSString stringWithFormat @ Content Disposition form data name @ filename file.bin r n r n FORM_FLE_INPUT dataUsingEncoding NSUTF8StringEncoding postData appendData data postData appendData..
EXC_BAD_ACCESS signal received http://stackoverflow.com/questions/327082/exc-bad-access-signal-received own the memory too and must release it when you are done. But if you get something back from just about anything else including factory methods e.g. NSString stringWithFormat then you'll have an autorelease reference which means it could be released at some time in the future by other code so it is vital that if you need to keep it around..
Bold & Non-Bold Text In A Single UILabel? http://stackoverflow.com/questions/3586871/bold-non-bold-text-in-a-single-uilabel df setDateFormat @ MM dd yyyy hh mm NSString dateString df stringFromDate refreshDate NSString prefix NSLocalizedString @ Updated nil NSString text NSString stringWithFormat @ @ @ prefix dateString df release Create the text layer on demand if _textLayer _textLayer CATextLayer alloc init _textLayer.font UIFont boldSystemFontOfSize..
display image from URL retrieved from ALAsset in iPhone http://stackoverflow.com/questions/3837115/display-image-from-url-retrieved-from-alasset-in-iphone objectAtIndex indexPath.row i am accessing the thumbnail here cell.imageView setImage UIImage imageWithCGImage asset thumbnail cell.textLabel setText NSString stringWithFormat @ Photo d indexPath.row 1 return cell iphone image url share improve this question The API has changed the rules slightly and you dont get direct file system..
iOS UIImagePickerController result image orientation after upload http://stackoverflow.com/questions/5427656/ios-uiimagepickercontroller-result-image-orientation-after-upload request setShouldContinueWhenAppEntersBackground YES other post keys values request setFile UIImageJPEGRepresentation self.image 100.0f withFileName NSString stringWithFormat @ d.jpg NSDate date timeIntervalSinceNow andContentType @ image jpg forKey @ imageFile request startAsynchronous the problem when i take a picture with the iphone..
Locking the Fields in MFMailComposeViewController http://stackoverflow.com/questions/6284599/locking-the-fields-in-mfmailcomposeviewcontroller doesn't work without TLS Only do this for self signed certs testMsg.validateSSLChain NO testMsg.delegate self email contents NSString bodyMessage NSString stringWithFormat @ This is the body of the email. You can put anything in here that you want. NSDictionary plainPart NSDictionary dictionaryWithObjectsAndKeys @ text plain kSKPSMTPPartContentTypeKey..
Objective C HTML escape/unescape http://stackoverflow.com/questions/659602/objective-c-html-escape-unescape NSString s self.resultString appendString s NSString convertEntiesInString NSString s if s nil NSLog @ ERROR Parameter string is nil NSString xmlStr NSString stringWithFormat @ d @ d s NSData data xmlStr dataUsingEncoding NSUTF8StringEncoding allowLossyConversion YES NSXMLParser xmlParse NSXMLParser alloc initWithData data autorelease..
Has anyone implemented the PayPal API through a native iPhone app? http://stackoverflow.com/questions/779423/has-anyone-implemented-the-paypal-api-through-a-native-iphone-app I used HTTP Client to check what I was doing. void sendPayPalRequestPOST perfomingSetMobileCheckout YES recordResults FALSE NSString parameterString NSString stringWithFormat @ USER @ PWD @ SIGNATURE @ VERSION 57.0 METHOD SetMobileCheckout AMT .2f CURRENCYCODE USD DESC @ RETURNURL @ userName password signature self.donationAmount @ Some.. parameterString NSURL url NSURL URLWithString paypalUrlNVP NSMutableURLRequest theRequest NSMutableURLRequest requestWithURL url NSString msgLength NSString stringWithFormat @ d parameterString length theRequest addValue msgLength forHTTPHeaderField @ Content Length theRequest setHTTPMethod @ POST theRequest setHTTPBody parameterString..
iPhone Data Usage Tracking/Monitoring http://stackoverflow.com/questions/7946699/iphone-data-usage-tracking-monitoring 0 int WWANReceived 0 NSString name NSString alloc init autorelease success getifaddrs addrs 0 if success cursor addrs while cursor NULL name NSString stringWithFormat @ s cursor ifa_name NSLog @ ifa_name s @ n cursor ifa_name name names of interfaces en0 is WiFi pdp_ip0 is WWAN if cursor ifa_addr sa_family AF_LINK if name..
Dispelling the UIImage imageNamed: FUD http://stackoverflow.com/questions/924740/dispelling-the-uiimage-imagenamed-fud style. UIImage imageFromMainBundleFile NSString aFileName NSString bundlePath NSBundle mainBundle bundlePath return UIImage imageWithContentsOfFile NSString stringWithFormat @ @ @ bundlePath aFileName Rincewind also included some example code to build your own optimised version. I can't see it is worth the maintentace but here it is..
File Upload to HTTP server in iphone programming http://stackoverflow.com/questions/936855/file-upload-to-http-server-in-iphone-programming request setURL NSURL URLWithString urlString request setHTTPMethod @ POST NSString boundary @ 14737809831466499882746641449 NSString contentType NSString stringWithFormat @ multipart form data boundary @ boundary request addValue contentType forHTTPHeaderField @ Content Type NSMutableData postbody NSMutableData data postbody appendData.. data boundary @ boundary request addValue contentType forHTTPHeaderField @ Content Type NSMutableData postbody NSMutableData data postbody appendData NSString stringWithFormat @ r n @ r n boundary dataUsingEncoding NSUTF8StringEncoding postbody appendData NSString stringWithFormat @ Content Disposition form data name userfile filename.. NSMutableData data postbody appendData NSString stringWithFormat @ r n @ r n boundary dataUsingEncoding NSUTF8StringEncoding postbody appendData NSString stringWithFormat @ Content Disposition form data name userfile filename @.jpg r n filename dataUsingEncoding NSUTF8StringEncoding postbody appendData NSString stringWithString @..
How do I record audio on iPhone with AVAudioRecorder? http://stackoverflow.com/questions/1010343/how-do-i-record-audio-on-iphone-with-avaudiorecorder dated file NSDate now NSDate dateWithTimeIntervalSinceNow 0 NSString caldate now description recorderFilePath NSString stringWithFormat @ @ @.caf DOCUMENTS_FOLDER caldate retain NSURL url NSURL fileURLWithPath recorderFilePath err nil recorder AVAudioRecorder..
How can I upload a photo to a server with the iPhone? http://stackoverflow.com/questions/125306/how-can-i-upload-a-photo-to-a-server-with-the-iphone urlRequest NSMutableURLRequest requestWithURL url urlRequest setHTTPMethod @ POST urlRequest setValue NSString stringWithFormat @ multipart form data boundary @ boundry forHTTPHeaderField @ Content Type NSMutableData postData NSMutableData dataWithCapacity.. @ Content Type NSMutableData postData NSMutableData dataWithCapacity data length 512 postData appendData NSString stringWithFormat @ @ r n boundry dataUsingEncoding NSUTF8StringEncoding postData appendData NSString stringWithFormat @ Content Disposition.. NSString stringWithFormat @ @ r n boundry dataUsingEncoding NSUTF8StringEncoding postData appendData NSString stringWithFormat @ Content Disposition form data name @ filename file.bin r n r n FORM_FLE_INPUT dataUsingEncoding NSUTF8StringEncoding postData..
EXC_BAD_ACCESS signal received http://stackoverflow.com/questions/327082/exc-bad-access-signal-received when you are done. But if you get something back from just about anything else including factory methods e.g. NSString stringWithFormat then you'll have an autorelease reference which means it could be released at some time in the future by other code so it..
Bold & Non-Bold Text In A Single UILabel? http://stackoverflow.com/questions/3586871/bold-non-bold-text-in-a-single-uilabel dateString df stringFromDate refreshDate NSString prefix NSLocalizedString @ Updated nil NSString text NSString stringWithFormat @ @ @ prefix dateString df release Create the text layer on demand if _textLayer _textLayer CATextLayer alloc init _textLayer.font..
display image from URL retrieved from ALAsset in iPhone http://stackoverflow.com/questions/3837115/display-image-from-url-retrieved-from-alasset-in-iphone the thumbnail here cell.imageView setImage UIImage imageWithCGImage asset thumbnail cell.textLabel setText NSString stringWithFormat @ Photo d indexPath.row 1 return cell iphone image url share improve this question The API has changed the rules slightly..
iOS UIImagePickerController result image orientation after upload http://stackoverflow.com/questions/5427656/ios-uiimagepickercontroller-result-image-orientation-after-upload YES other post keys values request setFile UIImageJPEGRepresentation self.image 100.0f withFileName NSString stringWithFormat @ d.jpg NSDate date timeIntervalSinceNow andContentType @ image jpg forKey @ imageFile request startAsynchronous the problem..
Locking the Fields in MFMailComposeViewController http://stackoverflow.com/questions/6284599/locking-the-fields-in-mfmailcomposeviewcontroller for self signed certs testMsg.validateSSLChain NO testMsg.delegate self email contents NSString bodyMessage NSString stringWithFormat @ This is the body of the email. You can put anything in here that you want. NSDictionary plainPart NSDictionary dictionaryWithObjectsAndKeys..
Objective C HTML escape/unescape http://stackoverflow.com/questions/659602/objective-c-html-escape-unescape s NSString convertEntiesInString NSString s if s nil NSLog @ ERROR Parameter string is nil NSString xmlStr NSString stringWithFormat @ d @ d s NSData data xmlStr dataUsingEncoding NSUTF8StringEncoding allowLossyConversion YES NSXMLParser xmlParse NSXMLParser..
Has anyone implemented the PayPal API through a native iPhone app? http://stackoverflow.com/questions/779423/has-anyone-implemented-the-paypal-api-through-a-native-iphone-app doing. void sendPayPalRequestPOST perfomingSetMobileCheckout YES recordResults FALSE NSString parameterString NSString stringWithFormat @ USER @ PWD @ SIGNATURE @ VERSION 57.0 METHOD SetMobileCheckout AMT .2f CURRENCYCODE USD DESC @ RETURNURL @ userName password.. paypalUrlNVP NSMutableURLRequest theRequest NSMutableURLRequest requestWithURL url NSString msgLength NSString stringWithFormat @ d parameterString length theRequest addValue msgLength forHTTPHeaderField @ Content Length theRequest setHTTPMethod @..
iPhone Data Usage Tracking/Monitoring http://stackoverflow.com/questions/7946699/iphone-data-usage-tracking-monitoring NSString alloc init autorelease success getifaddrs addrs 0 if success cursor addrs while cursor NULL name NSString stringWithFormat @ s cursor ifa_name NSLog @ ifa_name s @ n cursor ifa_name name names of interfaces en0 is WiFi pdp_ip0 is WWAN if cursor..
Dispelling the UIImage imageNamed: FUD http://stackoverflow.com/questions/924740/dispelling-the-uiimage-imagenamed-fud NSString aFileName NSString bundlePath NSBundle mainBundle bundlePath return UIImage imageWithContentsOfFile NSString stringWithFormat @ @ @ bundlePath aFileName Rincewind also included some example code to build your own optimised version. I can't see it..
File Upload to HTTP server in iphone programming http://stackoverflow.com/questions/936855/file-upload-to-http-server-in-iphone-programming request setHTTPMethod @ POST NSString boundary @ 14737809831466499882746641449 NSString contentType NSString stringWithFormat @ multipart form data boundary @ boundary request addValue contentType forHTTPHeaderField @ Content Type NSMutableData postbody.. contentType forHTTPHeaderField @ Content Type NSMutableData postbody NSMutableData data postbody appendData NSString stringWithFormat @ r n @ r n boundary dataUsingEncoding NSUTF8StringEncoding postbody appendData NSString stringWithFormat @ Content Disposition.. NSString stringWithFormat @ r n @ r n boundary dataUsingEncoding NSUTF8StringEncoding postbody appendData NSString stringWithFormat @ Content Disposition form data name userfile filename @.jpg r n filename dataUsingEncoding NSUTF8StringEncoding postbody..
|