All Questions
4,373
questions
168
votes
6
answers
100k
views
What is the difference between a .xib file and a .storyboard?
Can someone explain in simple words the difference between .xib and .storyboard?
161
votes
1
answer
23k
views
Xcode 4.2 - declaration of '...' will not be visible outside of this function warning
I use Apple Reachability class from Apple Sample code
Reachability
in Xcode 4.2 and new Apple 3.0 compiler I get warning in this class that
+ (Reachability*) reachabilityWithAddress: (const struct ...
128
votes
16
answers
82k
views
iPhone : How to detect the end of slider drag?
How to detect the event when the user has ended the drag of a slider pointer?
113
votes
6
answers
24k
views
To ARC or not to ARC? What are the pros and cons? [closed]
I've yet to use ARC, since the majority of the code in the project I'm working on at the moment was written pre-iOS 5.0.
I was just wondering, does the convenience of not retaining/releasing ...
109
votes
7
answers
58k
views
iOS 5 Best Practice (Release/retain?)
As a beginning iPhone programmer, what is the best practice for writing apps to be used either with iOS 5 or older versions? Specifically, should I continue using the release/retain of data, or should ...
108
votes
3
answers
15k
views
Override setter with arc
@interface Article : NSObject
@property (nonatomic, strong) NSString *imageURLString;
@end
@implementation Class
@synthesize imageURLString = _imageURLString;
- (void)setImageURLString:(NSString ...
103
votes
8
answers
51k
views
Is it possible to target older iOS versions when using Xcode 4.2 and iOS 5 SDK?
I just recently downloaded the Xcode 4.2 with iOS 5 SDK package and I immediately noticed that I am unable to use my iPhone 3Gs with iOS 4.2.1 for debugging. I am only able to debug and test on my ...
91
votes
5
answers
140k
views
What is the iOS 5.0 user agent string?
What is the iOS 5.0 user agent string?
Here is the iOS 4.0 user agent: What is the iPhone 4 user-agent?
88
votes
1
answer
128k
views
How to select Multiple images from UIImagePickerController [duplicate]
In my application, I have to select more images ie; up to 3 images from library or capture of images.
88
votes
9
answers
16k
views
Xcode version 4.6.2 (4H1003) compiler error
I just updated to Xcode version 4.6.2 (4H10003) and tried to run a previously working application project in the simulator and received the following error and the build failed.
PCH file built from ...
85
votes
4
answers
53k
views
ARC forbids Objective-C objects in structs or unions despite marking the file -fno-objc-arc
ARC forbids Objective-C objects in structs or unions despite marking the file -fno-objc-arc?
Why is this so?
I had the assumption that if you mark it -fno-objc-arc you don't have this restriction.
84
votes
10
answers
85k
views
Share data between two or more iPhone applications
Is this possible to share data between two applications on the same device?
Or can I allow some other application to use my application's information / data or in any other way?
For example, the ...
80
votes
7
answers
18k
views
AVAudioRecorder throws errors
I use AVAudioRecorder to record, it worked fine on iOS 4 devices, but yesterday we found out recording is broken on iOS5. Using the iPhone 5 simulator I got following error:
2011-08-02 11:09:03.586 ...
79
votes
1
answer
17k
views
What properties can I set via an UIAppearance proxy?
What properties can I set via an UIAppearance proxy? Apple's UIKit documentation does not list them. Is there a list of these properties?
66
votes
3
answers
14k
views
iMessage Style Receding Keyboard in an iOS App
I've been wondering if it is possible to replicate the behavior of Apple's iOS5 keyboard in the messages app, without using any private API calls. When you scroll down past the keyboard in the ...
59
votes
3
answers
46k
views
How to call an action when UISwitch changes state?
I want to perform some action when UISwitch changes its state, thus is set on or off. How do I do this? I need to pass two objects as parameters.
It's created in code, thus not using xib.
58
votes
4
answers
23k
views
Do I have to call addSubview after calling addChildViewController?
I'm trying to create a container view controller using iOS5 and new methods like addChildViewController.
Do I have to call addSubview after calling addChildViewController?
Do I have to call ...
57
votes
2
answers
80k
views
How to insert utf-8 mb4 character(emoji in ios5) in mysql?
I am using mysql 5.5.10, and its character_sets are
| character_set_client | utf8mb4 |
| character_set_connection | utf8mb4 |
| character_set_database | ...
54
votes
6
answers
42k
views
Get the extension of a file contained in an NSString
I have an NSMutable dictionary that contains file IDs and their filename+extension in the simple form of fileone.doc or filetwo.pdf. I need to determine what type of file it is to correctly display a ...
54
votes
7
answers
50k
views
How to change the UISwitch default color(blue)
How to change the default color(blue) of a UISwitch?
53
votes
4
answers
70k
views
Error with NSJSONSerialization - Invalid type in JSON write (Menu)
I have an App using core data with 3 entities with very similar attributes. The relationship is such as:
Branch ->> Menu ->> Category ->> FoodItem
Each entity has an associated class: example
I ...
51
votes
10
answers
18k
views
Unable to process application info.plist validation at this time due to a general error (1095)
I am creating a newsstand application. the application is ready, now i am trying to upload the app in apple store using Application Loader. While uploading the zip file its showing the error message ...
50
votes
9
answers
65k
views
Xcode/iOS5: Move UIView up, when keyboard appears
I'd like to move up my view, when the keyboard is shown. The keyboard (height: 216) should push up my view with it's height. Is this possible with a simple code?
50
votes
3
answers
19k
views
iOS 5: Curious about UIAppearance
On the tech talk 2011 I saw a speech about the new UIAppearance protocol. There is not a lot of documentation out there yet. I will shortly summarize what I remember to explain where my question is ...
46
votes
10
answers
32k
views
How to "cancel" a UIStoryBoardSegue
Does anyone know how to "stop" a segue transition conditionally:
My table view cells represent products which can be viewed in a drill-down "detail" view... or cannot! (It depends on a couple of ...
46
votes
6
answers
16k
views
iOS 5 does not allow to store downloaded data in Documents directory?
I have made an application for my client by keeping target iOS as 4.
But since the application still not submitted to Apple store, my client is planning to upgrade it for iOS 5.0.
For this I read ...
45
votes
1
answer
19k
views
how to use delegates with Automatic Reference Counting
I've jumped on the ARC bandwagon. In the past I would have my delegate properties declared like this:
@property(assign) id<MyProtocol> delegate;
So I thought I would do this under ARC:
@...
44
votes
4
answers
71k
views
Detect Focus Change for UITextField
I'm trying to set the animation for the view to move up when keyboard is hiding and appearing for the text fields and I got it to work perfectly fine, but when the focus moves from one text field to ...
44
votes
5
answers
71k
views
dismissViewControllerAnimated is called but ViewController is not dismissed
I am having a problems with the dismissViewControllerAnimated method not closing down the view.
What is happening in the app here is:
Cell in ItemViewController is selected.
View is pushed to ...
42
votes
4
answers
12k
views
What are the advantages and disadvantages of using ARC? [closed]
What are the advantages and disadvantages of using the new automatic reference counting (ARC) memory management style in an iOS project?
Can you choose not to use ARC when developing with the iOS 5.0 ...
40
votes
14
answers
57k
views
How to get the user's country calling code in iOS?
I am developing an iOS app in which the user enters their mobile number. How do I get their country calling code? For example, if a user is in India, then +91 should be prefixed automatically. Is ...
39
votes
3
answers
30k
views
To stop segue and show alert
Using iOS 5 storyboards, on a button I am performing a segue, what I want is to do validation on my textfield and if validation is failed I have to stop segue and throw an alert. Whats the way to do ...
38
votes
5
answers
13k
views
Crash when adding persistent store (iCloud enabled) in app delegate
I am going to start updating this to help those seeking to use this as reference for their own personal code.
Newest update
I'm fairly sure I have found a way to resync devices back together once ...
37
votes
2
answers
19k
views
UISegmentedControl change event not firing in iOS5
I have a UISegmentedControl whose "Value changed" event is wired up in Interface Builder to call my controller's -(IBAction)segmentChangeAction:(id)sender;
When the user taps on the control to change ...
36
votes
12
answers
48k
views
Unable to add a source with url
[!] Unable to add a source with url [email protected]:CocoaPods/Specs.git named master-1. You can try adding it manually in ~/.cocoapods/repos or via pod repo add. please any help
36
votes
2
answers
17k
views
Core Data's NSPrivateQueueConcurrencyType and sharing objects between threads
iOS 5 introduced a new way to quickly fetch data on a background thread by initializing the MOC using NSPrivateQueueConcurrencyType and then doing the fetch in performBlock:
One of the rules of thumb ...
36
votes
11
answers
20k
views
iOS5 show numeric keypad by default without using type="number" or type="tel"
With the release of iOS5, Apple has added their own validation to input type="number" form fields. This is causing some issues; see this question below which sums it up:
Input type='number' ...
36
votes
6
answers
7k
views
NSFetchedResultsController and NSOrderedSet relationships
I am having an issue (understanding issue to be honest) with NSFetchedResultsController and the new NSOrderedSet relationships available in iOS 5.
I have the following data-model (ok, my real one is ...
34
votes
7
answers
39k
views
Apple touch icon isn't showing up on the home screen
I'm using the following code to get touch icons for mobile devices - it's based on the html5boilerplate/mobile example:
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<...
33
votes
6
answers
38k
views
Modal view controller won't dismiss itself
What I'm doing:
In my app, I'm presenting a modal view controller (containing app settings) using the following code:
optionsViewController.modalTransitionStyle = ...
33
votes
5
answers
10k
views
Can you pass WiFi settings from an iOS device to an ExternalAccessory object?
I've heard that iOS 5 introduced a feature in which the iOS device can share its wifi configuration with a docked accessory via the ExternalAccessory framework. The trouble is that I can't find any ...
31
votes
5
answers
35k
views
How to write exif metadata to an image (not the camera roll, just a UIImage or JPEG)
I am aware of how to save metadata using ALAssets. But, I want to save an image, or upload it somewhere, with exif intact. I have exif data as an NSDictionary. But how can I inject it properly into a ...
31
votes
5
answers
5k
views
GLKView set drawable properties
I'm trying to port Apples GLPaint example to use GLKit. Using a UIView, its possible to return the CAEAGLLayer of the view and set the drawableProperties to include ...
29
votes
5
answers
18k
views
How can I init a text field in a UIAlertView
The updated UIAlertView now has a style which allows a Text input field in UIAlertView i.e.
alert.alertViewStyle = UIAlertViewStylePlainTextInput;
This works well but I wanted to init the input text ...
29
votes
7
answers
10k
views
iOS: different addSubview behavior between iOS 4.3 and 5.0
while coding in iOS 4.3 before, I found while add a view controller's view to another view with [superview addSubView:controller.view], the controller instance will not receive the -viewWillAppear/...
28
votes
6
answers
45k
views
Detect when home button is pressed iOS
I have several iOS apps that all use the same port to listen for a network beacon. On the main view I use viewWillDisappear to close the port when another view is opened, which was working great. ...
28
votes
4
answers
8k
views
Trying to "follow" someone on Twitter using new iOS 5 API, getting 406 return error. Why?
Trying to "follow" someone on Twitter using new iOS 5 API, getting 406 return error. Why?
Is my code correct? Need to find out why this isn't working....
- (void)followOnTwitter:(id)sender
{
...
28
votes
2
answers
13k
views
ARC, Blocks and Retain Cycles
Working on an iOS project that targets 4.0 and 5.0, using ARC.
Running into an issue related to blocks, ARC and referencing an object from outside the block. Here's some code:
__block ...
27
votes
4
answers
13k
views
How to test printing from iPhone App if we do not have AirPrint enabled Printers?
Is there a way to test whether correct pages are being passed for printing from iPhone App if we do not have AirPrint enabled printers?
Please let me know.
27
votes
9
answers
35k
views
UITextField - Rounded corner issue
I bring the issue forward which I face. I am creating a UITextField programmatically as below.
UItextField *mobileNumberField = [[UITextField alloc] initWithFrame:CGRectMake(10, 195, 300, 41)];
...