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)
Selecting any option will automatically load the page
Post
Replies
Boosts
Views
Activity
How do I get the microseconds of an object of type Date? I'm open to any suggestions. I'm not able to set the dateFormat property of DateFormatter to be able to show microseconds.
Anyone have any recommendations on how to resize a screen video of an iPhone from 750x1334 to 1080x1920 as required by App Store Connect? Or any alternative solutions?
Anyone ever tested Apple's sample code for SiriKit UnicornChat? How do I figure out what to say to Siri to see if the sample works?
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)
}
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.
Why am I getting an error message when I try to validate an archive that says, "No accounts with iTunes Connect access have been found for the team. iTunes Connect access is required for App Store distribution."?I have never gotten this error message before. What should I do?
How would I check for a return key tap on the keyboard when a text view is first responder? So far I think I have to check the text parameter in the shouldChangeTextIn callback method of UITextViewDelegate. How would I check whether text is a return?
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.
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?
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
Would someone explain something about this content I got from this URL to Apple documentation?
Logging
”You view log messages using the Console app, log command-line tool, or Xcode debug console. You can also access log messages programmatically using the OSLogframework.”
I’m not sure what Console app runs on. Is that an app on macOS? I’m not really sure what to ask really. I’m looking for a way to get debug data from people using my app who download it from the App Store, so they won’t be using TestFlight.
I did a search on Google but didn’t find what I needed to know. I’m trying to connect to the App Store on my iPhone, but it’s not able to connect. That seems to happen often for some reason.
I wonder if this is talking about the Console app that I’m wondering about? https://help.dayoneapp.com/en/articles/470117-using-ios-console
If Apple Documentation does not say whether a certain method is allowed to be run on a background thread other than the main UI thread, does that mean it can or cannot be run on a background thread?
I found information about the ABAddressBookRegisterExternalChangeCallback(::_:) function of the Address Book Framework, but that function has been deprecated, and only works with iOS 2.0–9.0. I don't see a function in the Contacts Framework that does what that function does. Is there some way that the Contacts Framework could do something that this function provided a solution for?
I noticed that when there is a generic class, there is a , which I decided must use T for "Type". What does the S mean in . I see it in the function definition for the instance function initialize(from: S) -> (S.Iterator, UnsafeMutableBufferPointer.Index) of UnsafeMutableBufferPointer.