An app I've been working on for weeks suddenly started giving me this error when I try to archive it:
"Command PhaseScriptExecution failed with a nonzero exit code"
I tried cleaning the build folder, restarting Xcode, and restarting the computer. The app compiles and runs, it just won't archive.
I deleted the entire project folder and re-cloned it, that didn't fix the problem either.
My coworker is able to archive the same project on his computer without any problem. The only difference we can find is that my computer has Xcode 14.3 and he has 14.2
Unfortunately I have no idea what the error message means. I think it might have something to do with Pods, but I didn't install the pods, and don't really understand how Pods work.
Is this a new bug in Xcode 14.3? What's the fix?
Thanks
Selecting any option will automatically load the page
Post
Replies
Boosts
Views
Activity
I have a popover view containing a tableview, and inside of the tableview are various UITextFields.
If one of the text fields is selected and the keyboard is showing, and I swipe downwards on the popover view, the popover closes, but the keyboard remains visible.
I updated my viewWillDisappear method on the view controller to have it issue a resignFirstResponder to the active input view when the popover closes, and although this code gets called, it doesn't close the keyboard.
The problem only exists on an iPhone. When I run the same code on an iPad, it works as expected (tapping outside of the popover view closes both the view and the keyboard).
If I dismiss the popover myself after issuing resignFirstResponder, that works. It is only the case where the user swipes down to dismiss that the problem appears.
Did something just change in Swift with regard to initializer inheritance?
Since installing Xcode 14.3, I have some code that is flagged with errors when I try to initialize a class using an initializer inherited from its superclass. This has always worked in the past.
I wrote an app for my own personal use. It is loaded onto my iPhone as a debug build and I also have a build on my Mac. These builds expire every few months and force me to go back into Xcode and rebuild them. Is there a better solution?
I am not an enterprise and don't have a business account, I'm just an individual developer.
class A: Codable {
var x: String?
}
class B: A {
var y: String?
}
When I try to decode class B, the property "y" remains nil even though there is a value for it in the JSON data. If I change it to B: Codable then it works.
When I try to search for a solution, all I can find is people overriding init methods and doing decoding manually in some way. I am having a hard time believeing that this is the right answer.
Surely, coding works across class hierarchies?
Topic:
Programming Languages
SubTopic:
Swift
My app needs to track background location for a period of several hours while the user is using it, and we want to allow the user to switch apps or lock their phone while this is happening. We don't need to track location permanently and because of this, we don't want to request the "Always allow" permission.
The app requests "While in use" permission and it has the "Location updates" background mode enabled. The CLLocationManager has 'allowsBackgroundLocationUpdates' set to true, 'pausesLocationUpdatesAutomatically' false, kCLLocationAccuracyBest, kCLDistanceFilterNone, and .fitness for the activity type (we expect the user to be walking).
The app also initializes a CLBackgroundActivitySession while it is tracking location and invalidates it when done.
When I test this combination on my iPhone, it works fine. I get location tracking in the background for as long as I need it, regardless of what else I do with the phone.
However, my customer says it doesn't work for him. He is using a Wifi-only iPad with an external GPS receiver called "BadElf GPS Pro". He says that the external GPS receiver works fine with other apps on his iPad. With my app, he gets background location tracking only for a short time, and then it stops.
The app does monitor the "locationManagerDidPauseLocationUpdates" callback and posts a local notification if it gets called, but it doesn't get called. I've also confirmed with him that he is not force-quitting the app and the app is not otherwise being terminated by iOS.
Is there something I'm missing?
I have an app, which has been in production for about 8 years, which uses a live camera view for the purpose of capturing barcodes. The app configures the camera for continuous autofocus with this code:
if ([videoDevice isFocusModeSupported:AVCaptureFocusModeContinuousAutoFocus]) {
videoDevice.focusMode = AVCaptureFocusModeContinuousAutoFocus;
}
This has worked fine for years, but a customer who just upgraded to an iPhone 14 says that it doesn't work on his phone; the image never focuses and the barcode cannot be read.
Has something changed recently, either in iOS or with the iPhone 14, that would render this code incorrect? Xcode does not flag it with any warnings.
Thanks,
Frank
I have some Swift classes in my project that extend an Objective-C base class, which in turn extends NSObject. I did this years ago when Swift was new in order to take advantage of some Objective-C code that was difficult to rewrite in Swift. It's not a common situation but it has been working fine for a long time.
One of these classes is used as the key to a Dictionary and thus needs to be Hashable. The way I did this was to implement an == function and override the 'hash' property. It is a very simple case where the identity of the object is based on a single integer:
static func == (lhs: FishModel, rhs: FishModel) -> Bool {
return lhs.fishId == rhs.fishId
}
override var hash: Int {
return fishId
}
I believe that I initially tried to add "Hashable" to the class definition but was told it was redundant. I'm not sure why that is, but it worked fine without it.
Today I took the latest Xcode update to 15.2, and now my project won't compile anymore. The compiler error says that my class "does not conform to protocol Hashable". Adding Hashable to the class definition did not fix it. There are also some unusual errors about missing files, such as abi.json, swiftdoc, swiftmodule, and swiftsourceinfo.
Was this caused by the Xcode update? How do I fix it?
I manage apps and servers on behalf of several customers. Recently they all started getting a message from Apple that says, "The Certification Authority for APNs is changing".
I don't understand how or if this affects me. My servers are all hosted on Amazon EC2 instances. I have never had to install any specific certificate for APNs to work.
Is this new CA something that I can expect my servers to receive automatically as part of their system updates? If not, how do I install it?
Topic:
App & System Services
SubTopic:
Notifications
I have a customer who wants to give his employees an iPad that does nothing other than display some fixed videos and PDF files. The customer has an Apple Business Manager account an an MDM. The solution we discussed is that my company would build their content into a simple app, distribute it to them via private distribution in the app store, and they would use their MDM to put it on their iPads in Single App Mode.
My concern is that Apple will still need to review the app and may reject it on the grounds that it violates the "Minimum Functionality" rule (4.2). Is this rule enforced even for B2B apps that are destined for private distribution?
Thanks,
Frank
My company uses Git repositories hosted with a service called Beanstalk. These are standard Git repositories that I can work with in the terminal window using the 'git' command line interface, which works fine and remembers my credentials.
I'd like to use Xcode's integrated version control support, but it has never worked correctly with my repositories. In some cases, it works but prompts me to enter my credentials each time I try to do something. In other cases, it fails with a message that says "failed to start SSH session: Unable to exchange encryption keys".
The account settings on Xcode only let you set up accounts with specific hosted Git services (Github, Gitlab, Bitbucket). It's nice that Xcode recognizes these specific Git providers, but how do I set up a repository that is hosted elsewhere?
Thanks.
When I submit a request for a background refresh through BGTaskScheduler, how likely is it that iOS will execute the task at the time I request?
I know that with the pre-iOS 13 way of doing this, iOS didn't really guarantee any particular schedule or frequency except that it it would try to execute the task when it wasn't busy. I don't see any language in BGTaskScheduler that talks about this. The only clue is that the field specifying the time is called "earliestBeginDate" which suggests that iOS might execute it later than that date.
If I submit a BGProcessingTaskRequest instead of a BGAppRefreshTaskRequest, does this change the behavior?
I'd like to know this so that I can tell my users what to expect.
Thanks,
Frank
Hi,
I have a dictionary defined as [String:Encodable].
I'm trying to encode it using JSONEncoder().encode().
When I do this I get a compiler error, "Type 'any Encodable' cannot conform to 'Encodable'".
What does this mean and how do I fix it?
How do I change the timezone on the simulator? I need to test how my app works in other timezones.
Hi,
I'm trying to learn how to use asynchronous functions in Swift. I've used async functions in other languages such as C#, so I understand the general concept.
I want to call getPendingNotificationRequests on UNUserNotificationCenter asynchronously, so I wrote this:
let notificationCenter = UNUserNotificationCenter.current()
let requests = await notificationCenter.getPendingNotificationRequests()
This seems to match the examples I see in documentation, but it doesn't work. All I get is a compiler error that says "Missing argument for parameter 'completionHandler'". What am I doing wrong?