Skip to main content

All Questions

Tagged with
Filter by
Sorted by
Tagged with
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 ...
Brock Woolf's user avatar
  • 47.1k
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, ...
Jacobo Koenig's user avatar
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 ...
Finglish's user avatar
  • 9,884
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 ...
Gergely's user avatar
  • 3,105
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 ...
uhfocuz's user avatar
  • 3,160
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 ...
Gamal A's user avatar
  • 2,473
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.
Ethan's user avatar
  • 5,749
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 ...
BoltClock's user avatar
  • 716k
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 ...
Jay's user avatar
  • 4,530
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 ...
Filip Majernik's user avatar
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. ...
Matthew Frederick's user avatar
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 ...
robestrong's user avatar
  • 1,835
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.
lassej's user avatar
  • 6,406
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 ...
Pratik Bhiyani's user avatar
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 ...
Keith's user avatar
  • 1,989
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 ...
Ben Gottlieb's user avatar
  • 85.5k
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 ...
Zakarius Jay Poggenpohl's user avatar
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 ...
Hubert Schölnast's user avatar
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 ...
Jason's user avatar
  • 14.6k
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....
qichunren's user avatar
  • 4,455
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 ...
Tulon's user avatar
  • 4,085
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?
Wilbur's user avatar
  • 1,343
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. ...
Chris Chen's user avatar
  • 5,367
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 ...
Dharmesh Kheni's user avatar
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 ...
Alec's user avatar
  • 1,247
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?
cyclingIsBetter's user avatar
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 ...
Sunil Chauhan's user avatar
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 ...
Libor Zapletal's user avatar
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.
Nitneuq's user avatar
  • 4,682
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/...
tbodt's user avatar
  • 16.9k
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 ...
Ken W.'s user avatar
  • 1,610
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 ...
Adam Fox's user avatar
  • 3,448
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 ...
Gavin Jensen's user avatar
  • 1,521
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.
Enrico Susatyo's user avatar
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 ...
Sabha B's user avatar
  • 2,079
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 ...
Sven Driemecker's user avatar
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 ...
shannoga's user avatar
  • 19.8k
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; ...
Chance Hudson's user avatar
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 ...
Todd Ditchendorf's user avatar
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 ...
matt's user avatar
  • 4,164
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 ...
Hardgraf's user avatar
  • 2,596
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 ...
Para's user avatar
  • 3,691
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 ...
user1947561's user avatar
  • 1,187
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?
marko's user avatar
  • 1,356
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?
choise's user avatar
  • 25k
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 ...
Dima's user avatar
  • 23.6k
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?
Prody's user avatar
  • 5,250
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....
Duck's user avatar
  • 35.7k

1
2 3 4 5
109