iphone Programming Glossary: use
How to check for an active Internet Connection on iPhone SDK? http://stackoverflow.com/questions/1083701/how-to-check-for-an-active-internet-connection-on-iphone-sdk I came up with a way to do this using an NSURL . The way I did it seems a bit unreliable because even Google could one day be down and relying on a 3rd party seems bad and while I could check to see.. the observer never gets unregistered so you should account for that as well. Note The domain you use doesn't matter. It's just testing for a gateway to any domain. Important Note The Reachability class.. just testing for a gateway to any domain. Important Note The Reachability class is one of the most used classes in projects so you might run into naming conflicts with other projects like ShareKit. If this..
How to programmatically send SMS on the iPhone? http://stackoverflow.com/questions/10848/how-to-programmatically-send-sms-on-the-iphone at a particular time of day Your best bet is to setup an intermediate server on the internet that uses an online SMS sending service and send the SMSs via that route if you need complete automation. ie.. a viewcontroller you can import into your application. You prepopulate the SMS fields then the user can initiate the SMS send within the controller. Unlike using the sms ... url format this allows your.. specify multiple recipients. This prevents applications from sending automated SMS without the user explicitly aware of it. You still cannot send fully automated SMS from the iPhone itself it requires..
iOS 6 apps - how to deal with iPhone 5 screen size? [duplicate] http://stackoverflow.com/questions/12396545/ios-6-apps-how-to-deal-with-iphone-5-screen-size with the iPhone 5 bigger screen size. As it has more pixels in height things like GCRectMake that use coordinates and just doubled the pixels with the retina non retina problem won't work seamlessly between.. iOS 6 then definitely consider using Auto Layout. It removes all fixed layout handling and instead uses constraints to lay things out. Nothing will be hard coded and your life will become a lot simpler... to support older iOS's then it really depends on your application. A majority of applications that use a standard navigation bar and or tab bar could simply expand the content in the middle to use up that..
Symbolicating iPhone App Crash Reports http://stackoverflow.com/questions/1460892/symbolicating-iphone-app-crash-reports line method name which resulted in crash. Ex classname functionName 510 Symbolicating IPA if we use IPA for symbolicating just rename the extention .ipa with .zip extract it then we can get a Payload..
Check iPhone iOS Version http://stackoverflow.com/questions/3339722/check-iphone-ios-version methods to check device capabilities if CLLocationManager headingAvailable Do something Apple uses systemVersion in their GLSprite sample code so my recommendation can't be absolute A system version.. code so my recommendation can't be absolute A system version of 3.1 or greater is required to use CADisplayLink. The NSTimer class is used as fallback when it isn't available. NSString reqSysVer @ 3.1.. absolute A system version of 3.1 or greater is required to use CADisplayLink. The NSTimer class is used as fallback when it isn't available. NSString reqSysVer @ 3.1 NSString currSysVer UIDevice currentDevice..
Can I embed a custom font in an iPhone application? http://stackoverflow.com/questions/360751/can-i-embed-a-custom-font-in-an-iphone-application application I would like to have an app include a custom font for rendering text load it and then use it with standard UIKit elements like UILabel. Is this possible I found these links http discussions.apple.com.. Edit As of iOS 3.2 this functionality is built in. If you need to support pre 3.2 you can still use this solution. I created a simple module that extends UILabel and handles loading .ttf files. I released.. here git github.com zynga FontLabel.git The important files are FontLabel.h and FontLabel.m. It uses some of the code from Genericrich's answer above. Browse the source here http github.com zynga FontLabel..
How do I create delegates in Objective-C? http://stackoverflow.com/questions/626898/how-do-i-create-delegates-in-objective-c do I create delegates in Objective C I know how delegates work and I know how I can use them. But how do I create them iphone ios objective c cocoa delegates share improve this question.. a class that implements the delegate methods you're interested in. Though with delegates that use a formal protocol you must declare your delegate to implement that protocol see below. For example suppose.. void windowDidMove NSNotification notification ... other methods here @end You would then use respondsToSelector as described above when calling this method. Delegates simply implement this method..
UIDevice uniqueIdentifier Deprecated - What To Do Now? http://stackoverflow.com/questions/6993325/uidevice-uniqueidentifier-deprecated-what-to-do-now problem going forward The suggestion from the documentation is... Special Considerations Do not use the uniqueIdentifier property. To create a unique identifier specific to your app you can call the CFUUIDCreate.. to the defaults database using the NSUserDefaults class. However this value won't be the same if a user uninstalls and re installs the app. iphone ios ipad share improve this question A UUID created.. iphone ios ipad share improve this question A UUID created by CFUUIDCreate is unique if a user uninstalls and re installs the app you will get a new one each time. But you might want it to be not..
How to check for an active Internet Connection on iPhone SDK? http://stackoverflow.com/questions/1083701/how-to-check-for-an-active-internet-connection-on-iphone-sdk this iphone objective c ios cocoa touch reachability share improve this question METHOD 1 Use a simple ARC and GCD compatible class to do it 1 Add SystemConfiguration framework to the project but..
Is it possible to register a http+domain-based URL Scheme for iPhone apps, like YouTube and Maps? http://stackoverflow.com/questions/1108693/is-it-possible-to-register-a-httpdomain-based-url-scheme-for-iphone-apps-like Safari will give an error in case the app is not installed. What would be a workaround One idea 1 Use http URLs that open in any desktop browser and render the service through the browser 2 Check the User.. http URLs that open in any desktop browser and render the service through the browser 2 Check the User Agent and in case it's Mobile Safari open a myprotocol URL to attempt to open the iPhone app and have..
How to detect iPhone 5 (widescreen devices)? http://stackoverflow.com/questions/12446990/how-to-detect-iphone-5-widescreen-devices rebuild all your views to fit a new screen nor use different views for different screen sizes. Use the auto resizing capabilities of iOS so your views can adjust and adapt any screen size. That's not..
Tricks for improving iPhone UITableView scrolling performance? http://stackoverflow.com/questions/1352479/tricks-for-improving-iphone-uitableview-scrolling-performance drawRect Make your UITableViewCell 's layer opaque same goes for the content view if you have one Use the reusableCellIdentifier functionality as recommended by the UITableView examples documentation Avoid..
Reading ePub format http://stackoverflow.com/questions/1388467/reading-epub-format backward buttons or swipes or something so that users can move from one chapter to another. Use the spine to work out which file to show next the itemrefs in the XML are in the order they should appear..
How can I get a writable path on the iPhone? http://stackoverflow.com/questions/1567134/how-can-i-get-a-writable-path-on-the-iphone through iTunes as of 3.2 NSArray paths NSSearchPathForDirectoriesInDomains NSDocumentDirectory NSUserDomainMask YES NSString documentsDirectory paths objectAtIndex 0 Secondly and very similar to the Documents.. to mess with through iTunes NSArray paths NSSearchPathForDirectoriesInDomains NSLibraryDirectory NSUserDomainMask YES NSString libraryDirectory paths objectAtIndex 0 Note that even though the user cannot.. delete them at some point NSArray paths NSSearchPathForDirectoriesInDomains NSCachesDirectory NSUserDomainMask YES NSString cachePath paths objectAtIndex 0 BOOL isDir NO NSError error if NSFileManager..
Build fat static library (device + simulator) using Xcode and SDK 4+ http://stackoverflow.com/questions/3520977/build-fat-static-library-device-simulator-using-xcode-and-sdk-4 # DEBUG_THIS_SCRIPT false if DEBUG_THIS_SCRIPT true then echo ########### TESTS ############# echo Use the following variables when debugging this script note that they may change on recursions echo BUILD_DIR.. echo if you embed your library project in another project you will need to add echo a User Search Headers build setting of NB INCLUDE THE DOUBLE QUOTES BELOW echo ' TARGET_BUILD_DIR usr local.. bottom. The very last line should read lipo for current configuration Debug creating output file Users blah Library Developer Xcode DerivedData AppName ashwnbutvodmoleijzlncudsekyf Build Products Debug..
Bold & Non-Bold Text In A Single UILabel? http://stackoverflow.com/questions/3586871/bold-non-bold-text-in-a-single-uilabel the attributed string if _label respondsToSelector @selector setAttributedText iOS6 and above Use NSAttributedStrings const CGFloat fontSize 13 UIFont boldFont UIFont boldSystemFontOfSize fontSize UIFont.. code it should work but it was brain compiled. I hope it is enough Old Answer for iOS5 and below Use a CATextLayer with an NSAttributedString much lighter and simpler than 2 UILabels. iOS 3.2 and above..
iPhone App Minus App Store? http://stackoverflow.com/questions/37464/iphone-app-minus-app-store using Build not Build Go . In the build Release iphoneos directory you will have an app bundle. Use your preferred method to transfer this to Applications on the device. scp r AccelerometerGraph.app root@jasoniphone..
iphone/ipad: How exactly use NSAttributedString? http://stackoverflow.com/questions/3786528/iphone-ipad-how-exactly-use-nsattributedstring 2 Affect the NSAttributedString to the OHAttributedLabel myAttributedLabel.attributedText attrStr Use the Justified alignment myAttributedLabel.textAlignment UITextAlignmentJustify Hello World will be displayed..
Fast and Lean PDF Viewer for iPhone / iPad / iOs - tips and hints? http://stackoverflow.com/questions/3889634/fast-and-lean-pdf-viewer-for-iphone-ipad-ios-tips-and-hints Some Tips Credit Luke Mcneice VdesmedT Matt Gallagher Johann Save any media to disk when you can. Use larger tileSizes if rendering on TiledLayers init frequently used arrays with placeholder objects alternitively.. another design approach is this one Note that images will render faster than a CGPDFPageRef Use NSOperations or GCD Blocks to prepare pages ahead of time. call CGContextSetInterpolationQuality ctx.. Off Screen Rendering render the next page for fast smooth display Documentation Quartz PDFObjects Used for meta info annotations thumbs Abobe PDF Spec Example projects Apple ZoomingPDF zooming UIScrollView..
iPhone - Backgrounding to poll for events http://stackoverflow.com/questions/4656214/iphone-backgrounding-to-poll-for-events can do sth. like this inside the expirationHandler from the long running task. Just try it out. Use your Console to see what happens... Have Fun Update 2 Sometimes simplifying things helps. My new approach..
iOS: how to perform an HTTP POST request? http://stackoverflow.com/questions/5537297/ios-how-to-perform-an-http-post-request c ios share improve this question You can use NSURLConnection as follows Set your NSURLRequest Use requestWithURL NSURL theURL to initialise the request. If you need to specify a POST request and or.. @ username NSString password @ password NSURLCredential credential NSURLCredential credentialWithUser username password password persistence NSURLCredentialPersistenceForSession challenge sender..
iPhone UIView Animation Best Practice http://stackoverflow.com/questions/630265/iphone-uiview-animation-best-practice this question From the UIView reference 's section about the beginAnimations context method Use of this method is discouraged in iPhone OS 4.0 and later. You should use the block based animation methods..
How do I get a background location update every n minutes in my iOS application? http://stackoverflow.com/questions/6347503/how-do-i-get-a-background-location-update-every-n-minutes-in-my-ios-application with the help of the Apple Developer Forums. I did the following Specify location background mode Use an NSTimer in the background by using UIApplication beginBackgroundTaskWithExpirationHandler In case..
Dispelling the UIImage imageNamed: FUD http://stackoverflow.com/questions/924740/dispelling-the-uiimage-imagenamed-fud imagenamed share improve this question tldr ImagedNamed is fine. It handles memory well. Use it and stop worrying. Edit Nov 2012 Note that this question dates from iOS 1.0 Image requirements and..
How to check for an active Internet Connection on iPhone SDK? http://stackoverflow.com/questions/1083701/how-to-check-for-an-active-internet-connection-on-iphone-sdk connection on the iPhone using the Cocoa Touch libraries. I came up with a way to do this using an NSURL . The way I did it seems a bit unreliable because even Google could one day be down and relying on a 3rd party seems bad and while I could check to see for a response from some other websites if Google didn't respond.. viewWillDisappear where you receive a memory warning and the observer never gets unregistered so you should account for that as well. Note The domain you use doesn't matter. It's just testing for a gateway to any domain. Important Note The Reachability class is one of the most used classes in projects so you might run.. that as well. Note The domain you use doesn't matter. It's just testing for a gateway to any domain. Important Note The Reachability class is one of the most used classes in projects so you might run into naming conflicts with other projects like ShareKit. If this happens you'll have to rename one of the pairs of Reachability.h..
How to programmatically send SMS on the iPhone? http://stackoverflow.com/questions/10848/how-to-programmatically-send-sms-on-the-iphone dialing operations. Imagine if the game instead dialed 911 at a particular time of day Your best bet is to setup an intermediate server on the internet that uses an online SMS sending service and send the SMSs via that route if you need complete automation. ie your program on the iPhone sends a UDP packet to your server.. sends the real SMS iOS 4 Update iOS 4 however now provides a viewcontroller you can import into your application. You prepopulate the SMS fields then the user can initiate the SMS send within the controller. Unlike using the sms ... url format this allows your application to stay open and allows you to populate both.. you to populate both the to and the body fields. You can even specify multiple recipients. This prevents applications from sending automated SMS without the user explicitly aware of it. You still cannot send fully automated SMS from the iPhone itself it requires some user interaction. But this at least allows you to populate..
iOS 6 apps - how to deal with iPhone 5 screen size? [duplicate] http://stackoverflow.com/questions/12396545/ios-6-apps-how-to-deal-with-iphone-5-screen-size resolution I was just wondering with how should we deal with the iPhone 5 bigger screen size. As it has more pixels in height things like GCRectMake that use coordinates and just doubled the pixels with the retina non retina problem won't work seamlessly between versions as it happened when we got the Retina . And will.. height would simply be black. If you only plan to support iOS 6 then definitely consider using Auto Layout. It removes all fixed layout handling and instead uses constraints to lay things out. Nothing will be hard coded and your life will become a lot simpler. However if you have to support older iOS's then it really depends.. your life will become a lot simpler. However if you have to support older iOS's then it really depends on your application. A majority of applications that use a standard navigation bar and or tab bar could simply expand the content in the middle to use up that extra points. Set the autoresizing mask of the center content..
Symbolicating iPhone App Crash Reports http://stackoverflow.com/questions/1460892/symbolicating-iphone-app-crash-reports name.app' 'app name' 0x0003b508 This would show you the exact line method name which resulted in crash. Ex classname functionName 510 Symbolicating IPA if we use IPA for symbolicating just rename the extention .ipa with .zip extract it then we can get a Payload Folder which contain app. In this case we don't need .dSYM file...
Check iPhone iOS Version http://stackoverflow.com/questions/3339722/check-iphone-ios-version Some classes like CLLocationManager and UIDevice provide methods to check device capabilities if CLLocationManager headingAvailable Do something Apple uses systemVersion in their GLSprite sample code so my recommendation can't be absolute A system version of 3.1 or greater is required to use CADisplayLink. The NSTimer.. Do something Apple uses systemVersion in their GLSprite sample code so my recommendation can't be absolute A system version of 3.1 or greater is required to use CADisplayLink. The NSTimer class is used as fallback when it isn't available. NSString reqSysVer @ 3.1 NSString currSysVer UIDevice currentDevice systemVersion.. in their GLSprite sample code so my recommendation can't be absolute A system version of 3.1 or greater is required to use CADisplayLink. The NSTimer class is used as fallback when it isn't available. NSString reqSysVer @ 3.1 NSString currSysVer UIDevice currentDevice systemVersion if currSysVer compare reqSysVer options..
Can I embed a custom font in an iPhone application? http://stackoverflow.com/questions/360751/can-i-embed-a-custom-font-in-an-iphone-application I embed a custom font in an iPhone application I would like to have an app include a custom font for rendering text load it and then use it with standard UIKit elements like UILabel. Is this possible I found these links http discussions.apple.com thread.jspa messageID 8304744 http forums.macrumors.com.. iphone ios cocoa touch fonts share improve this question Edit As of iOS 3.2 this functionality is built in. If you need to support pre 3.2 you can still use this solution. I created a simple module that extends UILabel and handles loading .ttf files. I released it opensource under the Apache license and put it on github..
How do I create delegates in Objective-C? http://stackoverflow.com/questions/626898/how-do-i-create-delegates-in-objective-c do I create delegates in Objective C I know how delegates work and I know how I can use them. But how do I create them iphone ios objective c cocoa delegates share improve this question An Objective C delegate is just an object that has been assigned.. There's no special process for creating them you simply define a class that implements the delegate methods you're interested in. Though with delegates that use a formal protocol you must declare your delegate to implement that protocol see below. For example suppose you have an NSWindow. If you'd like to implement its.. from NSWindow.h @interface NSObject NSWindowNotifications void windowDidMove NSNotification notification ... other methods here @end You would then use respondsToSelector as described above when calling this method. Delegates simply implement this method and they're done. This method is straight forward and common..
UIDevice uniqueIdentifier Deprecated - What To Do Now? http://stackoverflow.com/questions/6993325/uidevice-uniqueidentifier-deprecated-what-to-do-now device. Can anyone suggest any ideas how we might handle this problem going forward The suggestion from the documentation is... Special Considerations Do not use the uniqueIdentifier property. To create a unique identifier specific to your app you can call the CFUUIDCreate function to create a UUID and write it to the defaults.. the CFUUIDCreate function to create a UUID and write it to the defaults database using the NSUserDefaults class. However this value won't be the same if a user uninstalls and re installs the app. iphone ios ipad share improve this question A UUID created by CFUUIDCreate is unique if a user uninstalls and re installs.. won't be the same if a user uninstalls and re installs the app. iphone ios ipad share improve this question A UUID created by CFUUIDCreate is unique if a user uninstalls and re installs the app you will get a new one each time. But you might want it to be not unique i. e. it should stay the same when the user uninstalls..
How to check for an active Internet Connection on iPhone SDK? http://stackoverflow.com/questions/1083701/how-to-check-for-an-active-internet-connection-on-iphone-sdk deprecated in 3.0 And if so what is a better way to accomplish this iphone objective c ios cocoa touch reachability share improve this question METHOD 1 Use a simple ARC and GCD compatible class to do it 1 Add SystemConfiguration framework to the project but don't worry about including it anywhere 2 Add Tony Million's..
Is it possible to register a http+domain-based URL Scheme for iPhone apps, like YouTube and Maps? http://stackoverflow.com/questions/1108693/is-it-possible-to-register-a-httpdomain-based-url-scheme-for-iphone-apps-like suffix for this and register it in the Info.plist but Mobile Safari will give an error in case the app is not installed. What would be a workaround One idea 1 Use http URLs that open in any desktop browser and render the service through the browser 2 Check the User Agent and in case it's Mobile Safari open a myprotocol URL.. is not installed. What would be a workaround One idea 1 Use http URLs that open in any desktop browser and render the service through the browser 2 Check the User Agent and in case it's Mobile Safari open a myprotocol URL to attempt to open the iPhone app and have it open Mobile iTunes to the download of the app in case..
How to detect iPhone 5 (widescreen devices)? http://stackoverflow.com/questions/12446990/how-to-detect-iphone-5-widescreen-devices share improve this question First of all you shouldn't rebuild all your views to fit a new screen nor use different views for different screen sizes. Use the auto resizing capabilities of iOS so your views can adjust and adapt any screen size. That's not very hard read some documentation about that. It will save..
Tricks for improving iPhone UITableView scrolling performance? http://stackoverflow.com/questions/1352479/tricks-for-improving-iphone-uitableview-scrolling-performance the standard accessibility functionality the content view's drawRect Make your UITableViewCell 's layer opaque same goes for the content view if you have one Use the reusableCellIdentifier functionality as recommended by the UITableView examples documentation Avoid gradients complicated graphical effects that aren't pre..
Reading ePub format http://stackoverflow.com/questions/1388467/reading-epub-format
How can I get a writable path on the iPhone? http://stackoverflow.com/questions/1567134/how-can-i-get-a-writable-path-on-the-iphone store things you want to keep and make available to the user through iTunes as of 3.2 NSArray paths NSSearchPathForDirectoriesInDomains NSDocumentDirectory NSUserDomainMask YES NSString documentsDirectory paths objectAtIndex 0 Secondly and very similar to the Documents directory there is the Library folder where you store.. want to keep around but you don't want the user to be able to mess with through iTunes NSArray paths NSSearchPathForDirectoriesInDomains NSLibraryDirectory NSUserDomainMask YES NSString libraryDirectory paths objectAtIndex 0 Note that even though the user cannot see files in iTunes using a device older than 3.2 the iPad.. you don't care exist for the long term or not the phone may delete them at some point NSArray paths NSSearchPathForDirectoriesInDomains NSCachesDirectory NSUserDomainMask YES NSString cachePath paths objectAtIndex 0 BOOL isDir NO NSError error if NSFileManager defaultManager fileExistsAtPath cachePath isDirectory isDir..
Build fat static library (device + simulator) using Xcode and SDK 4+ http://stackoverflow.com/questions/3520977/build-fat-static-library-device-simulator-using-xcode-and-sdk-4 Tests helps workaround any future bugs in Xcode ######## # DEBUG_THIS_SCRIPT false if DEBUG_THIS_SCRIPT true then echo ########### TESTS ############# echo Use the following variables when debugging this script note that they may change on recursions echo BUILD_DIR BUILD_DIR echo BUILD_ROOT BUILD_ROOT echo CONFIGURATION_BUILD_DIR.. should work OK # echo Fetching headers from PUBLIC_HEADERS_FOLDER_PATH echo if you embed your library project in another project you will need to add echo a User Search Headers build setting of NB INCLUDE THE DOUBLE QUOTES BELOW echo ' TARGET_BUILD_DIR usr local include ' if d CURRENTCONFIG_DEVICE_DIR PUBLIC_HEADERS_FOLDER_PATH.. it but they didn't think of that in the main window scroll to bottom. The very last line should read lipo for current configuration Debug creating output file Users blah Library Developer Xcode DerivedData AppName ashwnbutvodmoleijzlncudsekyf Build Products Debug universal libTargetName.a ...that is the location of your Universal..
Bold & Non-Bold Text In A Single UILabel? http://stackoverflow.com/questions/3586871/bold-non-bold-text-in-a-single-uilabel NSString text @ Updated 2012 10 14 21 59 We only need to create the attributed string if _label respondsToSelector @selector setAttributedText iOS6 and above Use NSAttributedStrings const CGFloat fontSize 13 UIFont boldFont UIFont boldSystemFontOfSize fontSize UIFont regularFont UIFont systemFontOfSize fontSize UIColor foregroundColor.. Attributed strings for iOS using Interface Builder PS Above code it should work but it was brain compiled. I hope it is enough Old Answer for iOS5 and below Use a CATextLayer with an NSAttributedString much lighter and simpler than 2 UILabels. iOS 3.2 and above Example. Don't forget to add QuartzCore framework needed for..
iPhone App Minus App Store? http://stackoverflow.com/questions/37464/iphone-app-minus-app-store Build Configuration Release. Compile your project normally using Build not Build Go . In the build Release iphoneos directory you will have an app bundle. Use your preferred method to transfer this to Applications on the device. scp r AccelerometerGraph.app root@jasoniphone Applications Let SpringBoard know the new application..
iphone/ipad: How exactly use NSAttributedString? http://stackoverflow.com/questions/3786528/iphone-ipad-how-exactly-use-nsattributedstring attrStr setTextColor UIColor redColor range NSMakeRange 0 5 2 Affect the NSAttributedString to the OHAttributedLabel myAttributedLabel.attributedText attrStr Use the Justified alignment myAttributedLabel.textAlignment UITextAlignmentJustify Hello World will be displayed in the label justified Hello in red and World in gray...
Fast and Lean PDF Viewer for iPhone / iPad / iOs - tips and hints? http://stackoverflow.com/questions/3889634/fast-and-lean-pdf-viewer-for-iphone-ipad-ios-tips-and-hints of Drawing PDF's or any other issues discussed here EDIT Some Tips Credit Luke Mcneice VdesmedT Matt Gallagher Johann Save any media to disk when you can. Use larger tileSizes if rendering on TiledLayers init frequently used arrays with placeholder objects alternitively another design approach is this one Note that images.. init frequently used arrays with placeholder objects alternitively another design approach is this one Note that images will render faster than a CGPDFPageRef Use NSOperations or GCD Blocks to prepare pages ahead of time. call CGContextSetInterpolationQuality ctx kCGInterpolationHigh CGContextSetRenderingIntent ctx kCGRenderingIntentDefault.. issue but I'm not sure Credit BrainFeeder CALayer and Off Screen Rendering render the next page for fast smooth display Documentation Quartz PDFObjects Used for meta info annotations thumbs Abobe PDF Spec Example projects Apple ZoomingPDF zooming UIScrollView CATiledLayer vfr reader zooming paging UIScrollView CATiledView..
iPhone - Backgrounding to poll for events http://stackoverflow.com/questions/4656214/iphone-backgrounding-to-poll-for-events foreground. Then close the bgTask and you're done. Maybe one can do sth. like this inside the expirationHandler from the long running task. Just try it out. Use your Console to see what happens... Have Fun Update 2 Sometimes simplifying things helps. My new approach is this one void applicationDidEnterBackground UIApplication..
iOS: how to perform an HTTP POST request? http://stackoverflow.com/questions/5537297/ios-how-to-perform-an-http-post-request and getting back a plain text response. iphone objective c ios share improve this question You can use NSURLConnection as follows Set your NSURLRequest Use requestWithURL NSURL theURL to initialise the request. If you need to specify a POST request and or HTTP headers use NSMutableURLRequest with void setHTTPMethod.. NSURLAuthenticationChallenge challenge NSString username @ username NSString password @ password NSURLCredential credential NSURLCredential credentialWithUser username password password persistence NSURLCredentialPersistenceForSession challenge sender useCredential credential forAuthenticationChallenge challenge..
iPhone UIView Animation Best Practice http://stackoverflow.com/questions/630265/iphone-uiview-animation-best-practice iphone ios cocoa touch uiview core animation share improve this question From the UIView reference 's section about the beginAnimations context method Use of this method is discouraged in iPhone OS 4.0 and later. You should use the block based animation methods instead. Eg of Block based Animation based on Tom's Comment..
How do I get a background location update every n minutes in my iOS application? http://stackoverflow.com/questions/6347503/how-do-i-get-a-background-location-update-every-n-minutes-in-my-ios-application improve this question Found a solution to implement this with the help of the Apple Developer Forums. I did the following Specify location background mode Use an NSTimer in the background by using UIApplication beginBackgroundTaskWithExpirationHandler In case n is smaller than UIApplication backgroundTimeRemaining it..
Dispelling the UIImage imageNamed: FUD http://stackoverflow.com/questions/924740/dispelling-the-uiimage-imagenamed-fud algorithm please post it here. iphone caching uikit uiimageview imagenamed share improve this question tldr ImagedNamed is fine. It handles memory well. Use it and stop worrying. Edit Nov 2012 Note that this question dates from iOS 1.0 Image requirements and handling handling have moved on a lot since then. Retina makes..
How to check for an active Internet Connection on iPhone SDK? http://stackoverflow.com/questions/1083701/how-to-check-for-an-active-internet-connection-on-iphone-sdk Cocoa Touch libraries. I came up with a way to do this using an NSURL . The way I did it seems a bit unreliable because even Google could one day be down and relying on a 3rd party seems bad and while I could check to see for a response from.. a memory warning and the observer never gets unregistered so you should account for that as well. Note The domain you use doesn't matter. It's just testing for a gateway to any domain. Important Note The Reachability class is one of the most.. matter. It's just testing for a gateway to any domain. Important Note The Reachability class is one of the most used classes in projects so you might run into naming conflicts with other projects like ShareKit. If this happens you'll have..
How to programmatically send SMS on the iPhone? http://stackoverflow.com/questions/10848/how-to-programmatically-send-sms-on-the-iphone instead dialed 911 at a particular time of day Your best bet is to setup an intermediate server on the internet that uses an online SMS sending service and send the SMSs via that route if you need complete automation. ie your program on the.. 4 however now provides a viewcontroller you can import into your application. You prepopulate the SMS fields then the user can initiate the SMS send within the controller. Unlike using the sms ... url format this allows your application to stay.. fields. You can even specify multiple recipients. This prevents applications from sending automated SMS without the user explicitly aware of it. You still cannot send fully automated SMS from the iPhone itself it requires some user interaction...
iOS 6 apps - how to deal with iPhone 5 screen size? [duplicate] http://stackoverflow.com/questions/12396545/ios-6-apps-how-to-deal-with-iphone-5-screen-size how should we deal with the iPhone 5 bigger screen size. As it has more pixels in height things like GCRectMake that use coordinates and just doubled the pixels with the retina non retina problem won't work seamlessly between versions as it.. plan to support iOS 6 then definitely consider using Auto Layout. It removes all fixed layout handling and instead uses constraints to lay things out. Nothing will be hard coded and your life will become a lot simpler. However if you have.. However if you have to support older iOS's then it really depends on your application. A majority of applications that use a standard navigation bar and or tab bar could simply expand the content in the middle to use up that extra points. Set..
Symbolicating iPhone App Crash Reports http://stackoverflow.com/questions/1460892/symbolicating-iphone-app-crash-reports show you the exact line method name which resulted in crash. Ex classname functionName 510 Symbolicating IPA if we use IPA for symbolicating just rename the extention .ipa with .zip extract it then we can get a Payload Folder which contain..
Check iPhone iOS Version http://stackoverflow.com/questions/3339722/check-iphone-ios-version and UIDevice provide methods to check device capabilities if CLLocationManager headingAvailable Do something Apple uses systemVersion in their GLSprite sample code so my recommendation can't be absolute A system version of 3.1 or greater is.. in their GLSprite sample code so my recommendation can't be absolute A system version of 3.1 or greater is required to use CADisplayLink. The NSTimer class is used as fallback when it isn't available. NSString reqSysVer @ 3.1 NSString currSysVer.. can't be absolute A system version of 3.1 or greater is required to use CADisplayLink. The NSTimer class is used as fallback when it isn't available. NSString reqSysVer @ 3.1 NSString currSysVer UIDevice currentDevice systemVersion..
Can I embed a custom font in an iPhone application? http://stackoverflow.com/questions/360751/can-i-embed-a-custom-font-in-an-iphone-application font in an iPhone application I would like to have an app include a custom font for rendering text load it and then use it with standard UIKit elements like UILabel. Is this possible I found these links http discussions.apple.com thread.jspa.. this question Edit As of iOS 3.2 this functionality is built in. If you need to support pre 3.2 you can still use this solution. I created a simple module that extends UILabel and handles loading .ttf files. I released it opensource under.. and put it on github here git github.com zynga FontLabel.git The important files are FontLabel.h and FontLabel.m. It uses some of the code from Genericrich's answer above. Browse the source here http github.com zynga FontLabel tree master share..
How do I create delegates in Objective-C? http://stackoverflow.com/questions/626898/how-do-i-create-delegates-in-objective-c do I create delegates in Objective C I know how delegates work and I know how I can use them. But how do I create them iphone ios objective c cocoa delegates share improve this question An Objective C delegate.. them you simply define a class that implements the delegate methods you're interested in. Though with delegates that use a formal protocol you must declare your delegate to implement that protocol see below. For example suppose you have an NSWindow... NSWindowNotifications void windowDidMove NSNotification notification ... other methods here @end You would then use respondsToSelector as described above when calling this method. Delegates simply implement this method and they're done...
UIDevice uniqueIdentifier Deprecated - What To Do Now? http://stackoverflow.com/questions/6993325/uidevice-uniqueidentifier-deprecated-what-to-do-now we might handle this problem going forward The suggestion from the documentation is... Special Considerations Do not use the uniqueIdentifier property. To create a unique identifier specific to your app you can call the CFUUIDCreate function.. a UUID and write it to the defaults database using the NSUserDefaults class. However this value won't be the same if a user uninstalls and re installs the app. iphone ios ipad share improve this question A UUID created by CFUUIDCreate is.. re installs the app. iphone ios ipad share improve this question A UUID created by CFUUIDCreate is unique if a user uninstalls and re installs the app you will get a new one each time. But you might want it to be not unique i. e. it should..
How to check for an active Internet Connection on iPhone SDK? http://stackoverflow.com/questions/1083701/how-to-check-for-an-active-internet-connection-on-iphone-sdk way to accomplish this iphone objective c ios cocoa touch reachability share improve this question METHOD 1 Use a simple ARC and GCD compatible class to do it 1 Add SystemConfiguration framework to the project but don't worry about..
Is it possible to register a http+domain-based URL Scheme for iPhone apps, like YouTube and Maps? http://stackoverflow.com/questions/1108693/is-it-possible-to-register-a-httpdomain-based-url-scheme-for-iphone-apps-like but Mobile Safari will give an error in case the app is not installed. What would be a workaround One idea 1 Use http URLs that open in any desktop browser and render the service through the browser 2 Check the User Agent and in case.. One idea 1 Use http URLs that open in any desktop browser and render the service through the browser 2 Check the User Agent and in case it's Mobile Safari open a myprotocol URL to attempt to open the iPhone app and have it open Mobile iTunes..
How to detect iPhone 5 (widescreen devices)? http://stackoverflow.com/questions/12446990/how-to-detect-iphone-5-widescreen-devices of all you shouldn't rebuild all your views to fit a new screen nor use different views for different screen sizes. Use the auto resizing capabilities of iOS so your views can adjust and adapt any screen size. That's not very hard read some..
Tricks for improving iPhone UITableView scrolling performance? http://stackoverflow.com/questions/1352479/tricks-for-improving-iphone-uitableview-scrolling-performance the content view's drawRect Make your UITableViewCell 's layer opaque same goes for the content view if you have one Use the reusableCellIdentifier functionality as recommended by the UITableView examples documentation Avoid gradients complicated..
Reading ePub format http://stackoverflow.com/questions/1388467/reading-epub-format need to implement forward backward buttons or swipes or something so that users can move from one chapter to another. Use the spine to work out which file to show next the itemrefs in the XML are in the order they should appear to the reader...
How can I get a writable path on the iPhone? http://stackoverflow.com/questions/1567134/how-can-i-get-a-writable-path-on-the-iphone available to the user through iTunes as of 3.2 NSArray paths NSSearchPathForDirectoriesInDomains NSDocumentDirectory NSUserDomainMask YES NSString documentsDirectory paths objectAtIndex 0 Secondly and very similar to the Documents directory there.. the user to be able to mess with through iTunes NSArray paths NSSearchPathForDirectoriesInDomains NSLibraryDirectory NSUserDomainMask YES NSString libraryDirectory paths objectAtIndex 0 Note that even though the user cannot see files in iTunes.. or not the phone may delete them at some point NSArray paths NSSearchPathForDirectoriesInDomains NSCachesDirectory NSUserDomainMask YES NSString cachePath paths objectAtIndex 0 BOOL isDir NO NSError error if NSFileManager defaultManager fileExistsAtPath..
Build fat static library (device + simulator) using Xcode and SDK 4+ http://stackoverflow.com/questions/3520977/build-fat-static-library-device-simulator-using-xcode-and-sdk-4 in Xcode ######## # DEBUG_THIS_SCRIPT false if DEBUG_THIS_SCRIPT true then echo ########### TESTS ############# echo Use the following variables when debugging this script note that they may change on recursions echo BUILD_DIR BUILD_DIR echo.. from PUBLIC_HEADERS_FOLDER_PATH echo if you embed your library project in another project you will need to add echo a User Search Headers build setting of NB INCLUDE THE DOUBLE QUOTES BELOW echo ' TARGET_BUILD_DIR usr local include ' if d CURRENTCONFIG_DEVICE_DIR.. main window scroll to bottom. The very last line should read lipo for current configuration Debug creating output file Users blah Library Developer Xcode DerivedData AppName ashwnbutvodmoleijzlncudsekyf Build Products Debug universal libTargetName.a..
Bold & Non-Bold Text In A Single UILabel? http://stackoverflow.com/questions/3586871/bold-non-bold-text-in-a-single-uilabel We only need to create the attributed string if _label respondsToSelector @selector setAttributedText iOS6 and above Use NSAttributedStrings const CGFloat fontSize 13 UIFont boldFont UIFont boldSystemFontOfSize fontSize UIFont regularFont UIFont.. Builder PS Above code it should work but it was brain compiled. I hope it is enough Old Answer for iOS5 and below Use a CATextLayer with an NSAttributedString much lighter and simpler than 2 UILabels. iOS 3.2 and above Example. Don't forget..
iPhone App Minus App Store? http://stackoverflow.com/questions/37464/iphone-app-minus-app-store your project normally using Build not Build Go . In the build Release iphoneos directory you will have an app bundle. Use your preferred method to transfer this to Applications on the device. scp r AccelerometerGraph.app root@jasoniphone Applications..
iphone/ipad: How exactly use NSAttributedString? http://stackoverflow.com/questions/3786528/iphone-ipad-how-exactly-use-nsattributedstring NSMakeRange 0 5 2 Affect the NSAttributedString to the OHAttributedLabel myAttributedLabel.attributedText attrStr Use the Justified alignment myAttributedLabel.textAlignment UITextAlignmentJustify Hello World will be displayed in the label..
Fast and Lean PDF Viewer for iPhone / iPad / iOs - tips and hints? http://stackoverflow.com/questions/3889634/fast-and-lean-pdf-viewer-for-iphone-ipad-ios-tips-and-hints discussed here EDIT Some Tips Credit Luke Mcneice VdesmedT Matt Gallagher Johann Save any media to disk when you can. Use larger tileSizes if rendering on TiledLayers init frequently used arrays with placeholder objects alternitively another.. objects alternitively another design approach is this one Note that images will render faster than a CGPDFPageRef Use NSOperations or GCD Blocks to prepare pages ahead of time. call CGContextSetInterpolationQuality ctx kCGInterpolationHigh.. CALayer and Off Screen Rendering render the next page for fast smooth display Documentation Quartz PDFObjects Used for meta info annotations thumbs Abobe PDF Spec Example projects Apple ZoomingPDF zooming UIScrollView CATiledLayer vfr..
iPhone - Backgrounding to poll for events http://stackoverflow.com/questions/4656214/iphone-backgrounding-to-poll-for-events you're done. Maybe one can do sth. like this inside the expirationHandler from the long running task. Just try it out. Use your Console to see what happens... Have Fun Update 2 Sometimes simplifying things helps. My new approach is this one void..
iOS: how to perform an HTTP POST request? http://stackoverflow.com/questions/5537297/ios-how-to-perform-an-http-post-request iphone objective c ios share improve this question You can use NSURLConnection as follows Set your NSURLRequest Use requestWithURL NSURL theURL to initialise the request. If you need to specify a POST request and or HTTP headers use NSMutableURLRequest.. NSString username @ username NSString password @ password NSURLCredential credential NSURLCredential credentialWithUser username password password persistence NSURLCredentialPersistenceForSession challenge sender useCredential credential..
iPhone UIView Animation Best Practice http://stackoverflow.com/questions/630265/iphone-uiview-animation-best-practice share improve this question From the UIView reference 's section about the beginAnimations context method Use of this method is discouraged in iPhone OS 4.0 and later. You should use the block based animation methods instead. Eg of..
How do I get a background location update every n minutes in my iOS application? http://stackoverflow.com/questions/6347503/how-do-i-get-a-background-location-update-every-n-minutes-in-my-ios-application to implement this with the help of the Apple Developer Forums. I did the following Specify location background mode Use an NSTimer in the background by using UIApplication beginBackgroundTaskWithExpirationHandler In case n is smaller than UIApplication..
Dispelling the UIImage imageNamed: FUD http://stackoverflow.com/questions/924740/dispelling-the-uiimage-imagenamed-fud caching uikit uiimageview imagenamed share improve this question tldr ImagedNamed is fine. It handles memory well. Use it and stop worrying. Edit Nov 2012 Note that this question dates from iOS 1.0 Image requirements and handling handling..
How to post more parameters with image upload code in iOS? http://stackoverflow.com/questions/10618056/how-to-post-more-parameters-with-image-upload-code-in-ios WHETHER IN AN ACTION OF CONTRACT TORT OR OTHERWISE ARISING FROM OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. #import Foundation Foundation.h extern NSString const APIKey @interface NetworkClient.. WHETHER IN AN ACTION OF CONTRACT TORT OR OTHERWISE ARISING FROM OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. #import NetworkClient.h #import AFHTTPClient.h #import AFHTTPRequestOperation.h #import.. #import AFHTTPRequestOperation.h #import SBJson.h NSString const APIKey @ APIKEY GOES HERE IF YOU WANT TO USE ONE @implementation NetworkClient void processURLRequestWithURL NSString url andParams NSDictionary params block void..
Text-to-speech libraries for iPhone [duplicate] http://stackoverflow.com/questions/12839671/text-to-speech-libraries-for-iphone are many paid and free iOS TTS libraries are available . They are Free Offline Online iphone tts Note read HOW TO USE section . TTSOverview iOS flite 1.4 iphone Openears cmu.edu RJGoogleTTS VocalKit neospeech Paid Online iSpeech iOS SDK TTS..
Tap pressure strength detection using accelerometer http://stackoverflow.com/questions/5179426/tap-pressure-strength-detection-using-accelerometer EXEMPLARY OR CONSEQUENTIAL DAMAGES INCLUDING BUT NOT LIMITED TO PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES LOSS OF USE DATA OR PROFITS OR BUSINESS INTERRUPTION HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY WHETHER IN CONTRACT STRICT LIABILITY.. LIMITED TO PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES LOSS OF USE DATA OR PROFITS OR BUSINESS INTERRUPTION HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY WHETHER IN CONTRACT STRICT LIABILITY OR TORT INCLUDING NEGLIGENCE OR OTHERWISE ARISING IN.. LIABILITY WHETHER IN CONTRACT STRICT LIABILITY OR TORT INCLUDING NEGLIGENCE OR OTHERWISE ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. #import UIKit UIKit.h #define CPBPressureNone 0.0f #define..
Twitter Followers in iPhone sdk http://stackoverflow.com/questions/6633350/twitter-followers-in-iphone-sdk getFollowersIncludingCurrentStatus NO I m not getting followers list iphone sdk share improve this question USE like _engine getFollowersIncludingCurrentStatus YES And Call SOAuthEngine method to get list on console void userInfoReceived..
SFHFKeychainUtils. iOS keychain. ARC compatible http://stackoverflow.com/questions/7663443/sfhfkeychainutils-ios-keychain-arc-compatible WHETHER IN AN ACTION OF CONTRACT TORT OR OTHERWISE ARISING FROM OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. #import UIKit UIKit.h @interface SFHFKeychainUtils NSObject NSString getPasswordForUsername.. WHETHER IN AN ACTION OF CONTRACT TORT OR OTHERWISE ARISING FROM OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. #import SFHFKeychainUtils.h #import Security Security.h static NSString SFHFKeychainUtilsErrorDomain..
How to submit an iOS app WITHOUT XCode? http://stackoverflow.com/questions/7924085/how-to-submit-an-ios-app-without-xcode would like to send him a copy of his app which he can sign and submit to the iTunes app store but HE DOES NOT HAVE OR USE XCODE. While it's a backup plan I prefer not to walk him through the process of downloading and installing XCode through..
|