Questions tagged [ios]
iOS is the mobile operating system running on the Apple iPhone, iPod touch, and iPad. Use this tag [ios] for questions related to programming on the iOS platform. Use the related tags [objective-c] and [swift] for issues specific to those programming languages.
687,331
questions
462
votes
9
answers
316k
views
How to downgrade or install an older version of Cocoapods
How can I downgrade Cocoapods to an older version, or how can I install an older version of Cocoapods?
462
votes
6
answers
147k
views
@import vs #import - iOS 7
I am playing around with some of the new iOS 7 features and working with some of the Image Effects as discussed in the WWDC video "Implementing Engaging UI on iOS". For producing a blur effect within ...
459
votes
41
answers
528k
views
How to run CocoaPods on Apple Silicon (M1)
I have a Flutter project that I'm trying to run on iOS. It runs normally on my Intel-based Mac, but on my new Apple Silicon-based M1 Mac it fails to install pods.
LoadError - dlsym(0x7f8926035eb0, ...
458
votes
20
answers
222k
views
How do you perform wireless debugging in Xcode 9 with iOS 11, Apple TV 4K, etc?
Wireless debugging was recently added as a feature in Xcode 9, iOS 11, and tvOS 11. Apple TV 4K doesn't have a USB port, so it requires wireless debugging. How do you perform this wireless debugging ...
457
votes
33
answers
266k
views
Getting current device language in iOS?
I'd like to show the current language that the device UI is using. What code would I use?
I want this as an NSString in fully spelled out format. (Not @"en_US")
EDIT: For those driving on by, there ...
457
votes
24
answers
549k
views
Flutter - Wrap text on overflow, like insert ellipsis or fade
I'm trying to create a line in which center text has a maximum size, and if the text content is too large, it fits in size.
I insert the TextOverflow.ellipsis property to shorten the text and ...
457
votes
21
answers
544k
views
How to make HTTP request in Swift?
I read The Programming Language Swift by Apple in iBooks, but cannot figure out how to make an HTTP request (something like cURL) in Swift. Do I need to import Obj-C classes or do I just need to ...
450
votes
36
answers
336k
views
UIView with rounded corners and drop shadow?
I’ve been working on an application for a couple of years and received a simple design request: Round the corners on a UIView and add a drop shadow.To do as given below.
I want a custom UIView... : I ...
448
votes
42
answers
466k
views
How to use hex color values
I am trying to use hex color values in Swift, instead of the few standard ones that UIColor allows you to use, but I have no idea how to do it.
Example: how would I use #ffffff as a color?
448
votes
26
answers
252k
views
Symbolicating iPhone App Crash Reports
I'm looking to try and symbolicate my iPhone app's crash reports.
I retrieved the crash reports from iTunes Connect. I have the application binary that I submitted to the App Store and I have the ...
447
votes
25
answers
378k
views
How do I convert a Swift Array to a String?
I know how to programmatically do it, but I'm sure there's a built-in way...
Every language I've used has some sort of default textual representation for a collection of objects that it will spit ...
444
votes
31
answers
229k
views
Text inset for UITextField?
I would like to inset the text of a UITextField.
Is this possible?
444
votes
20
answers
220k
views
Status bar and navigation bar appear over my view's bounds in iOS 7
I recently downloaded Xcode 5 DP to test my apps in iOS 7. The first thing I noticed and confirmed is that my view's bounds is not always resized to account for the status bar and navigation bar.
In ...
443
votes
29
answers
199k
views
Core Data: Quickest way to delete all instances of an entity
I'm using Core Data to locally persist results from a Web Services call. The web service returns the full object model for, let's say, "Cars" - could be about 2000 of them (and I can't make the Web ...
442
votes
33
answers
381k
views
The simplest way to resize an UIImage?
In my iPhone app, I take a picture with the camera, then I want to resize it to 290*390 pixels. I was using this method to resize the image :
UIImage *newImage = [image _imageScaledToSize:...
441
votes
30
answers
1.1m
views
How do I install CocoaPods?
I referred to many links and tried, but I had no success. I read CocoaPods documents and many times tried to install, but I always failed because of the starting steps. I found one error whereby I can'...
439
votes
0
answers
111k
views
Capture image via captureStillImageAsynchronouslyFromConnection with no shutter sound [duplicate]
There are a lot of questions about this problem on SO:
AVFoundation, how to turn off the shutter sound when captureStillImageAsynchronouslyFromConnection?
How can I mute the capture sound in ...
438
votes
31
answers
528k
views
Code signing is required for product type 'Application' in SDK 'iOS 10.0' - StickerPackExtension requires a development team error
I am facing the below issue and am unable to build the application.
XXX has conflicting provisioning settings. XXX is automatically
provisioned, but provisioning profile WildCard has been ...
435
votes
42
answers
262k
views
Xcode "Device Locked" When iPhone is unlocked
When I tried to build and run, Xcode said my device was locked. I looked at my iPhone, and it's not locked at all. How do I fix this?
435
votes
4
answers
80k
views
Array state will be cached in iOS 12 Safari. Is it a bug or feature?
Update at 2018.10.31
This bug has been fixed in iOS 12.1, have a good day~
I found a problem with Array's value state in the newly released iOS 12 Safari, for example, code like this:
<!DOCTYPE ...
434
votes
11
answers
412k
views
Test iOS app on device without apple developer program or jailbreak
How can I test an iOS application on my iPod Touch without registering for the Apple Developer Program or jailbreaking my iPod?
Neither is a viable option at the moment.
I'd like to test on the ...
433
votes
19
answers
235k
views
How does one declare optional methods in a Swift protocol?
Is it possible in Swift? If not then is there a workaround to do it?
427
votes
6
answers
598k
views
iOS9 Untrusted Enterprise Developer with no option to trust
This is not a duplicate of Untrusted App Developer. Since iOS9 there is no option to trust an enterprise build. Has anyone found a workaround?
426
votes
39
answers
289k
views
How to validate an e-mail address in swift?
Does anyone know how to validate an e-mail address in Swift? I found this code:
- (BOOL) validEmail:(NSString*) emailString {
if([emailString length]==0){
return NO;
}
NSString *...
425
votes
17
answers
395k
views
How to use background thread in swift?
How to use threading in swift?
dispatchOnMainThread:^{
NSLog(@"Block Executed On %s", dispatch_queue_get_label(dispatch_get_current_queue()));
}];
422
votes
12
answers
101k
views
How dangerous is it to compare floating point values?
I know UIKit uses CGFloat because of the resolution independent coordinate system.
But every time I want to check if for example frame.origin.x is 0 it makes me feel sick:
if (theView.frame.origin.x ...
420
votes
15
answers
379k
views
How to create dispatch queue in Swift 3
In Swift 2, I was able to create queue with the following code:
let concurrentQueue = dispatch_queue_create("com.swift3.imageQueue", DISPATCH_QUEUE_CONCURRENT)
But this doesn't compile in Swift 3.
...
419
votes
32
answers
238k
views
Set padding for UITextField with UITextBorderStyleNone
I wanted to use a custom background for my UITextFields. This works fine except for the fact that I have to use UITextBorderStyleNone to make it look pretty. This forces the text to stick to the left ...
419
votes
37
answers
281k
views
UITableView - scroll to the top
In my table view I have to scroll to the top. But I cannot guarantee that the first object is going to be section 0, row 0. May be that my table view will start from section number 5.
So I get an ...
417
votes
20
answers
375k
views
How can I change the app display name build with Flutter?
I have created the app using Flutter create testapp.
Now, I want to change the app name from "testapp" to "My Trips Tracker". How can I do that?
I have tried changing from the ...
415
votes
19
answers
379k
views
Set UIButton title UILabel font size programmatically
I need to set the font size of the title UILabel of a UIButton programmatically.
414
votes
4
answers
50k
views
Design for Facebook authentication in an iOS app that also accesses a secured web service
Goal:
Allow a user to authentication with Facebook into an iOS application which requires access to a protected web service that I'm running.
Assumptions:
There is a native authentication (and ...
407
votes
47
answers
377k
views
Add placeholder text inside UITextView in Swift?
How can I add a placeholder in a UITextView, similar to the one you can set for UITextField, in Swift?
407
votes
8
answers
166k
views
File is universal (three slices), but it does not contain a(n) ARMv7-s slice error for static libraries on iOS, anyway to bypass?
I upgraded Xcode version and when using external static libraries, I get this message:
ld: file is universal (3 slices) but does not contain a(n) armv7s slice: /file/location for architecture ...
406
votes
21
answers
139k
views
Can you animate a height change on a UITableViewCell when selected?
I'm using a UITableView in my iPhone app, and I have a list of people that belong to a group. I would like it so that when the user clicks on a particular person (thus selecting the cell), the cell ...
403
votes
14
answers
216k
views
iPhone hide Navigation Bar only on first page
I have the code below that hides and shows the navigational bar. It is hidden when the first view loads and then hidden when the "children" get called. Trouble is that I cannot find the event/action ...
399
votes
19
answers
534k
views
How to create a delay in Swift?
I want to pause my app at a certain in point. In other words, I want my app to execute the code, but then at a certain point, pause for 4 seconds, and then continue on with the rest of the code. How ...
399
votes
26
answers
306k
views
Creating a blurring overlay view
In the Music app of the new iOS, we can see an album cover behind a view that blurs it.
How can something like that be accomplished? I've read the documentation, but did not find anything there.
397
votes
8
answers
130k
views
How to use dark mode in iOS simulator?
While I am developing the iOS app I need to test it in simulator with dark mode option so I can get more clarity about the app UI. But when I go to the Setting I am not getting option for dark mode as ...
391
votes
33
answers
208k
views
How do you add multi-line text to a UIButton?
I have the following code...
UILabel *buttonLabel = [[UILabel alloc] initWithFrame:targetButton.bounds];
buttonLabel.text = @"Long text string";
[targetButton addSubview:buttonLabel];
[targetButton ...
391
votes
50
answers
304k
views
Applications are expected to have a root view controller at the end of application launch
I get the following error in my console:
Applications are expected to have a root view controller at the end of application launch
Below is my application:didFinishLaunchWithOptions method:
- (...
390
votes
21
answers
361k
views
Swift - encode URL
If I encode a string like this:
var escapedString = originalString.stringByAddingPercentEscapesUsingEncoding(NSUTF8StringEncoding)
it doesn't escape the slashes /.
I've searched and found this ...
390
votes
6
answers
154k
views
iOS 10: "[App] if we're in the real pre-commit handler we can't actually add any new fences due to CA restriction"
I sometimes get this message in the logs of Xcode 8b3 when running my app, everything seems to work, but I'd like to know where this comes from. Google did not help at all.
388
votes
35
answers
590k
views
pod install -bash: pod: command not found
I installed pod some time ago. However, it's stopped working so I'm working through this again.
However, I almost immediately run into a problem here:
pod install
-bash: pod: command not found
Any ...
387
votes
37
answers
269k
views
Missing file libarclite_iphoneos.a (Xcode 14.3)
After installing Xcode 14.3 in order to run my app on my iOS 16.3 iPhone XS. I get the following error:
File not found: /Applications/Xcode-beta.app/Contents/Developer/Toolchains/XcodeDefault....
384
votes
7
answers
295k
views
iTunes Connect: How to choose a good SKU?
I'm reading the iTunes Connect Developer Guide as I'm trying to add a new application to iTunes Connect.
I'm a bit confused about the SKU number which I should provide. On page 81 in the above ...
383
votes
23
answers
199k
views
Images can't contain alpha channels or transparencies
Apple has released new version of iTunes Connect & I got an error message when I tried to set Screenshots on itunes connect for my app.
"Images can't contain alpha channels or transparencies."
382
votes
8
answers
209k
views
Objective-C ARC: strong vs retain and weak vs assign
There are two new memory management attributes for properties introduced by ARC, strong and weak.
Apart from copy, which is obviously something completely different, are there any differences between ...
381
votes
35
answers
251k
views
How do I put the image on the right side of the text in a UIButton?
I don't want to use a subview if I can avoid it. I want a UIButton with a background image, text, and an image in it. Right now, when I do that, the image is on the left side of the text. The ...
379
votes
15
answers
223k
views
How to localise a string inside the iOS info.plist file?
As you might know the iOS 8 requires NSLocationWhenInUseUsageDescription key for using user's location. I have added this key and some general information into my info plist.
How can I use ...