All Questions
5,407
questions
1408
votes
39
answers
514k
views
How can I check for an active Internet connection on iOS or macOS?
I would like to check to see if I have an Internet connection on iOS using the Cocoa Touch libraries or on macOS using the Cocoa libraries.
I came up with a way to do this using an NSURL. The way I ...
1323
votes
82
answers
1.0m
views
Xcode - How to fix 'NSUnknownKeyException', Reason: "… this class is not key value coding-compliant for the key X" error?
I'm trying to link a UILabel with an IBOutlet created in my class.
My application is crashing with the following error"
***
Terminating app due to uncaught exception
'NSUnknownKeyException', ...
467
votes
42
answers
554k
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, ...
339
votes
15
answers
74k
views
iPhone Simulator suddenly started running very slow
I have been working on an app in iphone simulator for a number of weeks and it has been running well up until now, but all of a sudden has begun running very slow both when loading content and ...
284
votes
19
answers
237k
views
Check OS version in Swift?
I'm trying to check system information in Swift. I figured out, that it could be achieved by code:
var sysData:CMutablePointer<utsname> = nil
let retVal:CInt = uname(sysData)
I have two ...
262
votes
20
answers
162k
views
Getting the difference between two Dates (months/days/hours/minutes/seconds) in Swift
I am trying to get the difference between the current date as NSDate() and a date from a PHP time(); call for example: NSDate(timeIntervalSinceReferenceDate: 1417147270). How do I go about getting the ...
246
votes
14
answers
100k
views
error while build iOS app in Xcode : Sandbox: rsync.samba (13105) deny(1) file-write-create, Flutter failed to write to a file
while building iOS app on Xcode I got these 2 errors, I tried to build the iOS on visual studio code and I got the same errors. the operating system macOS 14.0 beta. processor M1 Pro
Could ...
241
votes
25
answers
109k
views
Easy way to see saved NSUserDefaults?
Is there a way to see what's been saved to NSUserDefaults directly? I'd like to see if my data saved correctly.
239
votes
5
answers
42k
views
What kind of leaks does automatic reference counting in Objective-C not prevent or minimize?
In the Mac and iOS platforms, memory leaks are often caused by unreleased pointers. Traditionally, it has always been of utmost importance to check your allocs, copies and retains to make sure each ...
219
votes
13
answers
173k
views
NSRange from Swift Range?
Problem: NSAttributedString takes an NSRange while I'm using a Swift String that uses Range
let text = "Long paragraph saying something goes here!"
let textRange = text.startIndex..<text.endIndex
...
183
votes
40
answers
75k
views
Cannot generate iOS App archive in xcode
I have a problem generating a iOS App archive from an application. The application compiles just fine and even works in the simulator. Now I wanted to make som ad hoc testing and cannot generate the ...
181
votes
12
answers
68k
views
Moving Files into a Real Folder in Xcode
When I started my project I was happy to use Groups in Xcode rather than literal folders: Since I'm using the browser in Xcode to access everything, stuff was nicely organized and I was happy.
...
175
votes
7
answers
243k
views
How to Completely Uninstall Xcode and Clear All Settings
I have an issue that I can only assume is with Xcode, where my apps take forever to run and crash the phone/restart about 75% of the time. I tried using older versions of the code that I'd saved ...
162
votes
9
answers
86k
views
How to use Namespaces in Swift?
The documentation only mentions nested types, but it's not clear if they can be used as namespaces. I haven't found any explicit mentioning of namespaces.
157
votes
6
answers
93k
views
Fatal error: use of unimplemented initializer 'init(coder:)' for class
I decided to continue my remaining project with Swift. When I add the custom class (subclass of UIViewcontroller) to my storyboard view controller and load the project, the app crashes suddenly with ...
155
votes
7
answers
147k
views
How to get a user's time zone?
Does anyone know of a way to get a users time zone in Swift?
I'm getting a specific time something is on t.v. out of a database and then need to subtract/add from where they are located to show them ...
146
votes
10
answers
79k
views
Suppressing deprecated warnings in Xcode
With all the SDKs floating around, it's handy to be able to build for multiple SDKs and platforms. However, bouncing from 3.2 to 3.0 and even occasionally 2.x, I frequently get deprecated warnings ...
141
votes
16
answers
115k
views
Bundle.main.path(forResource:ofType:inDirectory:) returns nil
Try not to laugh or cry -- I'm just getting back into coding after 20 years out...
I've spent more than 4 hours looking at references and trying code snippets to get Bundle.main.path to open my text ...
130
votes
4
answers
29k
views
What makes a keychain item unique (in iOS)?
My question concerns keychains in iOS (iPhone, iPad, ...). I think (but am not sure) that the implementation of keychains under Mac OS X raises the same question with the same answer.
iOS provides ...
128
votes
3
answers
80k
views
How to get Core Data object from specific Object ID?
I can easily get an object's ID in Core Data using the following code:
NSManagedObjectID *moID = [managedObject objectID];
However, is there a way to get an object out of the core data store by ...
128
votes
7
answers
55k
views
Should I git ignore xcodeproject/project.pbxproj file?
in a XCode project, I offen got xcodeproject/project.pbxproj file changed, but useless info for me, it for compile.
Should I git ignore this file and xcodeproject/projectxworkspace/username....
128
votes
3
answers
7k
views
App Store Connect message: Your account will soon need to be migrated to federated auth
I am getting this message on my App Store Connect:
Your account will soon need to be migrated to federated auth. You can start the process now or wait until August 28, 2020 for your account to be ...
127
votes
10
answers
97k
views
How to get my IP address programmatically on iOS/macOS?
I would like to obtain my iPad's IP address programmatically.
How can I query the networking subsystem to find out what my IPv4 (and IPv6) addresses are?
PS: Can I disable IPv6 somehow?
118
votes
1
answer
152k
views
Xcode stops working after set "xcode-select -switch"
OMG, what I've done?
Couple of days ago, I tried using macport to install something, because I'm using Xcode 4.3 and the command-line tool hadn't been installed by the time, macport wouldn't work. ...
117
votes
10
answers
78k
views
How can I convert from degrees to radians?
I am trying to convert this Obj-C code to Swift code but I don't know what the equivalent of this code should be ?
#define DEGREES_TO_RADIANS(degrees)((M_PI * degrees)/180)
I googled and found this
...
116
votes
9
answers
74k
views
Swift - which types to use? NSString or String
With the introduction of Swift I've been trying to get my head round the new language
I'm an iOS developer and would use types such as NSString, NSInteger, NSDictionary in an application. I've ...
113
votes
7
answers
138k
views
How do I create a release build in Xcode?
Why is it that when I build an application, Xcode creates a debug build? I want to create a release build. How can I do this?
112
votes
2
answers
3k
views
Problem setting video frame rate using AVAssetWriter/AVAssetReader
Situation:
I am trying to export video with some parameters like video bit rate, audio bit rate, frame rate, changing video resolution, etc. Note that I am letting the user set the video frame rate in ...
109
votes
5
answers
69k
views
Xcode - free to clear devices folder?
I am deleting some folders and files to make more space on my drive. I know that in path:
~/Library/Developer/CoreSimulator/Devices/
There are folders for each simulator and each version. This ...
108
votes
23
answers
45k
views
Hidden Features of Xcode 4
Now that Xcode 4 is officially released it's time for a follow up to my previous question: Hidden Features of Xcode
So what are they? What are those hidden little Xcode 4 hints & tips that you ...
106
votes
25
answers
194k
views
How to solve "error running pod install" in flutter on mac?
I have an error when I tried to launch my project on my iPhone, the basic Flutter example is working on my iPhone but when I use my project I have this error.
102
votes
9
answers
35k
views
Xcode linker error: file too small for architecture x86_64
I'm developing an application in Xcode.
When I try to build, this error comes up:
ld: in /Users/theodore/Library/Developer/Xcode/DerivedData/Tower-bkpdifuqssebjdgurzmtirbxejnn/Build/Intermediates/...
99
votes
12
answers
122k
views
macOS on VMware doesn't recognize iOS device
I am using Mac OS in VMWare for iOS app development.
After updating the OS and Xcode, the iOS device isn't available so I cannot test it.
When the device is plugged in to the PC, the device appears ...
96
votes
12
answers
69k
views
WKWebView in Interface Builder
It seems that the IB object templates in XCode 6 beta are still creating old-style objects (UIWebView for iOS and WebView for OSX). Hopefully Apple will update them for the modern WebKit, but until ...
90
votes
7
answers
55k
views
How can I change a SwiftUI Color to UIColor?
I'm trying to change a SwiftUI Color to an instance of UIColor.
I can easily get the RGBA from the UIColor, but I don't know how to get the "Color" instance to return the corresponding RGB ...
87
votes
2
answers
28k
views
How do I comment lines in .plist file?
How do I comment out lines in my .plist file in my iOS/Mac projects?
I want to comment out the settings that I don't want to expose for this version of the project, but I may want to expose it later.
86
votes
4
answers
116k
views
Objective C - Assign, Copy, Retain
I'm new to Objective C. I have basic knowledge in C, including the concept of pointers. I have two basic questions:
Can someone explain the difference between assign,copy, and retain with some ...
84
votes
8
answers
38k
views
security / codesign in Sierra: Keychain ignores access control settings and UI-prompts for permission
Starting with macOS Sierra, I can't import a codesign-identity into a keychain with /usr/bin/security any more without usr/bin/codesign UI-prompting for access when using this identity. This breaks ...
84
votes
4
answers
44k
views
ARC - The meaning of __unsafe_unretained?
Just want to make sure that I got it right:
Do I need to __unsafe_unretain objects that I don't own?
If an object is __unsafe_unretained Do I need to use assign in the @property? Does that mean that ...
80
votes
3
answers
37k
views
What is the strong property attribute
I am using the Xcode beta for developers, and am noticing some subtle differences. Among them is a new attribute for declared properties.
@property(strong)IBOutlet NSArrayController *arrayControl;
...
79
votes
16
answers
65k
views
How do I determine the OS version at runtime in OS X or iOS (without using Gestalt)?
The Gestalt() function located in CarbonCore/OSUtils.h has been deprecated as of OS X 10.8 Mountain Lion.
I often use this function to test the version of the OS X operating system at runtime (see ...
77
votes
19
answers
48k
views
How do you convert an iPhone OSStatus code to something useful?
I am getting more than a little sick of this iPhone SDK and its documentation...
I am calling AudioConverterNew
in the documentation under Returns: it says "returns a status code"
...
really...
so ...
76
votes
7
answers
79k
views
Xamarin Visual Studio IOS Development Without a Mac?
I'm a .NET developer and want to write an IOS & Android app in C#. I've had a read around Xamarin for Visual Studio which looks interesting if not a tad expensive!
Do you need a Mac to debug your ...
75
votes
1
answer
17k
views
Xcode Project Format: what are the differences between 3.1, 3.2, 6.3 and 8.0?
When I open a project in Xcode 9 (or previous versions) and check the File Inspector, there's a section called Project Document, with a combo box named Project Format.
The available options (in Xcode ...
73
votes
7
answers
52k
views
How to determine device type from Swift? (OS X or iOS)
I know Swift is relatively new, but I was wondering if there was a way to determine the device type?
(Like you used to be able to do with a #define)?
Mainly I would like to know how to differentiate ...
72
votes
11
answers
32k
views
Turn off sound in iPhone Simulator
Is there an option to turn off the sound on the iPhone Simulator?
Or to adjust the volume?
70
votes
2
answers
16k
views
shortcut to open method dropdown in xcode
I am looking for a way to open the method popup that shows up when you click the navigation-bar in XCode.
is there a way to do this by using a shortcut?
69
votes
2
answers
3k
views
tgmath.h doesn't work if modules are enabled
I looked into using tgmath.h to deal with the CGFloat typedef float/double mess when dealing with arm64.
This answer has a pretty good description of how to use it, except that it didn't work at all ...
68
votes
12
answers
22k
views
Cocoa-Touch: How do I see if two NSDates are in the same day?
I need to know if two NSDate instances are both from the same day.
Is there an easier/better way to do it than getting the NSDateComponents and comparing day/month/year?
68
votes
2
answers
20k
views
Xcode - scribble, guard edges and guard malloc
Can someone explain what do these options in Xcode do?
Enable Scribble
Enable Guard Edges
Enable Guard Malloc
what they are and what they do and how useful can they be for debugging/testing?
thanks....