Post

Replies

Boosts

Views

Activity

Error in storyboard
I am getting an error on my Storyboard where a bar button item is enlarged and placed in the root view of a view controller. Strange.I think I need to reinstall Xcode. How would I do that? I have three versions on my Mac mini.It looks like I need to download the latest version instead of install it through the App Store. Where is that again?
4
0
1.3k
Dec ’20
Why does ShapeEdit use FileManager copyItem instead of setUbiquitous?
I have a question about code in the ShapeEdit sample from Apple.I their code, as shown below, why did they use FileManager's copyItem method instead of its setUbiquitous method? Didn't the documentation say explicitly to use setUbiquitous method? NSFileCoordinator().coordinate(with: [readIntent, writeIntent], queue: self.coordinationQueue) { error in if error != nil { return } do { try fileManager.copyItem(at: readIntent.url, to: writeIntent.url) try (writeIntent.url as NSURL).setResourceValue(true, forKey: URLResourceKey.hasHiddenExtensionKey) OperationQueue.main.addOperation { self.openDocumentAtURL(writeIntent.url) } } catch { fatalError("Unexpected error during trivial file operations: \(error)") } }
1
0
937
Jan ’21
What happens when I delete an App ID in my developer account?
I clicked the delete button to an App ID in my developer account and I got a message saying "All certificates associated with the App ID will be deleted and any provisioning profiles associated with this App ID will be invalidated." Why would the entire provisioning profile be invalidated? What about the other App IDs in that provisioning profile? Does that mean I wouldn't be able to use the provisioning profile for those other App IDs at all?
2
0
3.3k
Feb ’21
Why are table view cells not showing in table view?
I am using more than one table view cell class on a table view. I have registered the reuse identifiers and the xibs. For some reason the cells are not showing. What should I check. I'm stumped.Here is my code:import UIKit class DetailTableViewController: UITableViewController { let items = [0, 1] override func viewDidLoad() { super.viewDidLoad() tableView.register(DueDateSwitchTableViewCell.self, forCellReuseIdentifier: "DueDateSwitchTableViewCell") let xibDueDateSwitchTableViewCell = UINib(nibName: "DueDateSwitchTableViewCell", bundle: Bundle.main) tableView.register(xibDueDateSwitchTableViewCell, forCellReuseIdentifier: "DueDateSwitchTableViewCell") tableView.register(DueDatePickerTableViewCell.self, forCellReuseIdentifier: "DueDatePickerTableViewCell") let xibDueDatePickerTableViewCell = UINib(nibName: "DueDatePickerTableViewCell", bundle: Bundle.main) tableView.register(xibDueDatePickerTableViewCell, forCellReuseIdentifier: "DueDatePickerTableViewCell") } override func numberOfSections(in tableView: UITableView) -> Int { return 1 } override func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int { return items.count } override func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell { print("tableView(_:cellForRowAt:)", "indexPath.row=", indexPath.row) let cell = UITableViewCell() switch indexPath.row { case 0: print("\tcase 0") let cell = tableView.dequeueReusableCell(withIdentifier: "DueDateSwitchTableViewCell", for: indexPath) as! DueDateSwitchTableViewCell cell.backgroundColor = UIColor.yellow case 1: print("\tcase 1") let cell = tableView.dequeueReusableCell(withIdentifier: "DueDatePickerTableViewCell", for: indexPath) as! DueDatePickerTableViewCell cell.datePicker.date = Date() default: break } return cell } }The cells show the numbers when I use this code in tableView(_:cellForRowAt:) before the line that says "return cell": cell.textLabel!.text = String(items[indexPath.section].hashValue)
Topic: UI Frameworks SubTopic: UIKit Tags:
3
0
13k
Jul ’21
I am getting validation error message creating sandbox tester account.
I am having trouble creating a sandbox tester account in App Store. I keep getting an error message saying there are one or more validation errors when I click on "Invite", but there are no indications of any errors. None of the fields are marked with red for an error.What is going on? Is there a limit of the number of sandbox tester accounts I can create? Is anyone else having trouble with this?
66
1
46k
Aug ’21
Environment variables
In Info.plist of my Xcode project, I see for instance "Executable file" is set to "$(EXECUTABLE_NAME)". I believe that "$(EXECUTABLE_NAME)" is called an environment variable. What I'd like to know is where is that environment variable set. I'd like to see where all the environment variables are set so I can use those values.
6
0
12k
Sep ’21
Transformable properties errors
I'm getting the following error messages:CoreData: annotation: Failed to load optimized model at path '/var/containers/Bundle/Application/0E3DF5FB-DA57-4A63-98FE-59E2961C6F50/Routes.app/GoogleMaps.bundle/GMSCacheStorage.momd/StorageWithTileProto.omo'2020-01-11 17:19:50.885657-0600 Routes[1913:394464] [error] fault: One or more models in this application are using transformable properties with transformer names that are either unset, or set to NSKeyedUnarchiveFromDataTransformerName. Please switch to using "NSSecureUnarchiveFromData" or a subclass of NSSecureUnarchiveFromDataTransformer instead. At some point, Core Data will default to using "NSSecureUnarchiveFromData" when nil is specified, and transformable properties containing classes that do not support NSSecureCoding will become unreadable.. . .CoreData: warning: Property 'value' on Entity 'GMSCacheProperty' is using nil or an insecure NSValueTransformer. Please switch to using "NSSecureUnarchiveFromData" or a subclass of NSSecureUnarchiveFromDataTransformer instead.. . .2020-01-11 17:20:08.491131-0600 Routes[1913:394093] Can't end BackgroundTask: no background task exists with identifier 13 (0xd), or it may have already been ended. Break in UIApplicationEndBackgroundTaskError() to debug.I don't know what the problem is because I am not using any CoreData Attributes of type Transformable nor is there any code in my project about anything transformable. I have searched with Google for this error, but have not found a solution that works.
4
0
3.0k
Sep ’21
How do I cause a timer to fire while the app is in the background?
When I write code for a timer like below, the timer doesn't fire if the device is locked. How do I cause the code in the timer closure to run when the app is in the background? Are there any other ways to cause specific code to run at a certain time when the app is in the background? func setTimer(alarm: UTIAlarm) { let timer = Timer(fire: alarm.date!, interval: 0, repeats: false) { (timer: Timer) in print("timer fire \(self.dateFormatter.string(from: alarm.date!))") do { try AVAudioSession.sharedInstance().setActive(true, options: .notifyOthersOnDeactivation) } catch { print("Failed to setActive AVAudioSession from timer closure.") print(error.localizedDescription) } let predicate = MPMediaPropertyPredicate(value: alarm.mediaItem!.title, forProperty: MPMediaItemPropertyTitle) let query = MPMediaQuery() query.addFilterPredicate(predicate) self.playerController!.setQueue(with: query) self.playerController!.play() } runLoop.add(timer, forMode: .default) timers.append(timer) }
Topic: UI Frameworks SubTopic: UIKit Tags:
7
0
3.7k
Oct ’21
Does unifiedContacts(matching:keysToFetch:) return only unified contacts and leave out non-unified contacts?
When I use the Contacts Framework with Swift for iOS 15 using Xcode 13, when I use CNContactStore instance method unifiedContacts(matching:keysToFetch:), what happens to those CNContact objects that are not linked with any other CNContact objects, would they be returned as non-unified contacts, or would they be left out since they are non-unified contacts?
2
0
881
Nov ’21
How do I set the default contacts container for my iOS app to the contacts container that is saved in iCloud?
I am writing an iOS app using Swift and Xcode 13.1. I am using the Contacts Framework, and I read that each app has a default contacts container, and the default container in an app can be different than the default container in another app, and there is not a default container for the entire device. What determines which is the default container for the app made by an Xcode project? I didn't set the default container for my app and somehow the contacts container for a Google account became the default contacts container for my app. How do I use code to set the default contacts container for my app? How do I find out which is the default container of Apple's Contacts app that comes with iOS? I would like to set my app's default contacts container to the same default container of Apple's Contacts app, if that is the contacts container that is saved on iCloud. If not, I would like to set my app's default contacts container to the contacts container that is saved in iCloud. I assume that only one contacts container is saved on iCloud.
0
0
547
Dec ’21
How do I write code to run when the contact store was changed by another app, but not run when the contact store was changed by my app?
I noticed that when my app changes the contact store, the CNContactStoreDidChange notification fires in my app. How do I check if the notification fired because my app changed it. Is there a way to know which app made the change to the contact store. I need to know so I can write code to run only if the contact store was changed by another app instead of my app.
1
0
712
Dec ’21
Why is it when I set UITableViewController navigationItem.searchController with UISearchController, navigation.searchController still is nil?
For some reason, when I set UITableViewController navigationItem.searchController with a UISearchController, it doesn't take it. Here is my code: let searchController = UISearchController(searchResultsController: nil) if #available(iOS 11.0, *) { print("?", navigationItem.searchController) print("!", searchController) navigationItem.searchController? = searchController print("?", navigationItem.searchController) } else { tableView.tableHeaderView = searchController.searchBar } Here is the debug window: ? nil ! <UISearchController: 0x105077600> ? nil
1
0
378
Dec ’21