I have a UIViewController wherein I set nav items, basically the title and the rightBarButtonItem. I use a SF Symbol for the image. The code is extremely simple. Here it is.
func setupNavItem() {
self.navigationItem.title = "Problem in This View"
let helpImage = UIImage(systemName: "questionmark.circle")
let rightBarItem = UIBarButtonItem(image: helpImage, style: .plain, target: self, action: #selector(showHideHelp))
navigationItem.rightBarButtonItem = rightBarItem
}
When I navigate into this view, all heck breaks loose with the constraints. What gives? I'm using Xcode Version 14.0 beta 3 (14A5270f). See the constraint info below.
2022-07-18 16:58:59.998394-0400 NavBarItemExample[28793:996095] [LayoutConstraints] Unable to simultaneously satisfy constraints.
Probably at least one of the constraints in the following list is one you don't want.
Try this:
(1) look at each constraint and try to figure out which you don't expect;
(2) find the code that added the unwanted constraint or constraints and fix it.
"<NSLayoutConstraint:0x600000a79810 UIImageView:0x136d28790.width <= _UIModernBarButton:0x136d274b0.width (active)>",
"<NSLayoutConstraint:0x600000a7af80 '_UITemporaryLayoutWidth' _UIButtonBarButton:0x136d27280.width == 0 (active)>",
"<NSLayoutConstraint:0x600000a793b0 'IB_Leading_Leading' H:|-(>=11)-[_UIModernBarButton:0x136d274b0] (active, names: '|':_UIButtonBarButton:0x136d27280 )>",
"<NSLayoutConstraint:0x600000a79400 'IB_Trailing_Trailing' H:[_UIModernBarButton:0x136d274b0]-(8)-| (active, names: '|':_UIButtonBarButton:0x136d27280 )>"
)
Will attempt to recover by breaking constraint
<NSLayoutConstraint:0x600000a79810 UIImageView:0x136d28790.width <= _UIModernBarButton:0x136d274b0.width (active)>
Make a symbolic breakpoint at UIViewAlertForUnsatisfiableConstraints to catch this in the debugger.
Post
Replies
Boosts
Views
Activity
Anybody else come from an Aerospace background? In aerospace, the vector is stationary and the frame is rotated, for the most part, whereas here, the frame is stationary and the vector is rotated. Opposite rotations. It would be nice to have one document which discusses all of the reference frames with cartoons showing the axes. The Ferry Building example helped me a great deal when I looked at a map of the Ferry Building area and realized that the cardinal axis that location anchors are pretended is South (along the z axis). Makes sense. That's why it needed to be rotated by -51.4 degrees.
I want to move an Entity in from the right programmatically, but the move function is not working. I am using image tracking. I can place the entity statically, so I know I'm detecting the image. Here is my function.
func placeMyPictureEntity(imageAnchor: ARImageAnchor) {
if let entity = try? Experience.loadMyScene() {
entity.scale = SIMD3(0, 0, 0)
let imageAnchorEntity = AnchorEntity(anchor: imageAnchor)
imageAnchorEntity.name = imageAnchor.name!
// Position the entity to the side
let anchorWidth = Float(imageAnchor.referenceImage.physicalSize.width)
entity.setPosition(SIMD3<Float>(x: 20.0*anchorWidth , y: 0.0, z: 0.0), relativeTo: imageAnchorEntity)
let newTransform = Transform(scale: SIMD3(20.0, 20.0, 20.0), rotation: simd_quaternion(0, 0, 0, 1), translation: SIMD3(x: anchorWidth, y: 0.0, z: 0.0))
entity.move(to: newTransform, relativeTo: imageAnchorEntity, duration: 2.0, timingFunction: .easeIn)
imageAnchorEntity.addChild(entity)
// Add anchor to scene
arView.scene.addAnchor(imageAnchorEntity)
}
}
Any help would be most appreciated. Thanks.
The function in question is the following.
func records(for ids: [CKRecord.ID], desiredKeys: [CKRecord.FieldKey]? = nil) async throws -> [CKRecord.ID : Result<CKRecord, Error>]
Note that the returned value looks like a dictionary of the form [CKRecord.ID : Result<CKRecord, Error>], but the input is an array of CKRecord.IDs.
There are similar functions, but they return a tuple. Like the below example.
func records(matching query: CKQuery, inZoneWith zoneID: CKRecordZone.ID? = nil, desiredKeys: [CKRecord.FieldKey]? = nil, resultsLimit: Int = CKQueryOperation.maximumResults) async throws -> (matchResults: [(CKRecord.ID, Result<CKRecord, Error>)], queryCursor: CKQueryOperation.Cursor?)
Note that matchedResults is an array of tuples consisting of [(CKRecord.ID, Result<CKRecord, Error>)].
I would have thought that the return type in the first function would also be of the form [(CKRecord.ID, Result<CKRecord, Error>)].
What am I missing?
Anybody converting from CKQueryOperation to the new CloudKit async await methods? If so, what do you think? I'm currently playing with
func records(matching query: CKQuery, inZoneWith zoneID: CKRecordZone.ID? = nil, desiredKeys: [CKRecord.FieldKey]? = nil, resultsLimit: Int = CKQueryOperation.maximumResults) async throws -> (matchResults: [(CKRecord.ID, Result<CKRecord, Error>)], queryCursor: CKQueryOperation.Cursor?)
and
func records(continuingMatchFrom queryCursor: CKQueryOperation.Cursor, desiredKeys: [CKRecord.FieldKey]? = nil, resultsLimit: Int = CKQueryOperation.maximumResults) async throws -> (matchResults: [(CKRecord.ID, Result<CKRecord, Error>)], queryCursor: CKQueryOperation.Cursor?)
They seem to work fine and eliminate completion handlers.
I get the following.
403 Forbidden
Anybody else have this problem?
When I try to log into CloudKit Dashboard via Safari, I get a blank screen as a result. The only way I am able to get in is thru Xcode and my app that uses CloudKit Dashboard. Anybody else experiencing this?
Thanks
I have a CloudKit / Core Data app with saved entities. In my app, the user can modify an attribute of one of the entities and resave the entity in Core Data. I can see the modified attribute on the device I used to modify the information, but the entity does not sync to my other devices. Is there a way to get the entity to sync using CloudKit?
I am using Core Data with CloudKit and I realized that a Core Data Entity was not saved and therefore that did not show up in the CloudKit Schema. I am running my app in the Development environment and saving the entity, but it's not showing up in the Schema. How do I get CloudKit to see this in the Schema and do I need to use the Development environment? If so, if I deploy to production, will that mess up my other entities in the schema?
I've created a macOS app using Catalyst from my iPad app. I see this message in the console and I need to know what it means. Thanks.
For iOS 14 and watchOS 7.0, I completely recoded and modernized my app using Swift (was Objective C). I am almost done and am most proud of the job, but I have this issue that I need to fix on the Apple Watch app. I am not able to transfer data to the Apple Watch from the iPhone and get the following console messages. (The [***:xxxxxx] are my modification of the console messages.). I am guessing that the first 2 messages are the thing I need to fix and I need to fix this issue before I submit the app.
2020-09-24 08:29:02.873423-0400 WatchApp Extension[***:xxxxxx] [default] lookupMainFuncAddressInMachHeader:71: Invalid Swift entry point data
2020-09-24 08:29:02.874413-0400 WatchApp Extension[***:xxxxxx] [default] lookupMainFuncAddressInMachHeader:77: Swift entry point addres could not be determined.
2020-09-24 08:29:04.001368-0400 WatchApp Extension[***:xxxxxx] [WC] denying activation due to missing delegate
ExtensionDelegate: your iphone is Reachable
ExtensionDelegate: Session activated
2020-09-24 08:29:10.884500-0400 WatchApp Extension[***:xxxxxx] [WC] already in progress or activated
2020-09-24 08:29:15.046379-0400 WatchApp Extension[***:xxxxxx] [WC] WCSession is missing its delegate
2020-09-24 08:29:15.047176-0400 WatchApp Extension[***:xxxxxx] [WC] WCSession is missing its delegate
2020-09-24 08:29:15.047860-0400 WatchApp Extension[***:xxxxxx] [WC] WCSession is missing its delegate
2020-09-24 08:29:15.782075-0400 WatchApp Extension[***:xxxxxx] [WC] already in progress or activated
2020-09-24 08:29:24.390293-0400 WatchApp Extension[***:xxxxxx] [WC] already in progress or activated
2020-09-24 08:31:57.059417-0400 WatchApp Extension[***:xxxxxx] [WC] already in progress or activated
2020-09-24 08:32:00.055282-0400 WatchApp Extension[***:xxxxxx] [WC] already in progress or activated
InterfaceController: your iphone is Reachable
2020-09-24 08:32:00.058230-0400 WatchApp Extension[***:xxxxxx] [WC] already in progress or activated
2020-09-24 08:32:08.427192-0400 WatchApp Extension[***:xxxxxx] [WC] already in progress or activated
2020-09-24 08:32:13.374677-0400 WatchApp Extension[***:xxxxxx] [WC] WCSession is missing its delegate
2020-09-24 08:32:13.375717-0400 WatchApp Extension[***:xxxxxx]] [WC] WCSession is missing its delegate
2020-09-24 08:32:13.376426-0400 WatchApp Extension[***:xxxxxx] [WC] WCSession is missing its delegate
2020-09-24 08:32:51.861915-0400 WatchApp Extension[***:xxxxxx] [WC] already in progress or activated
I've been testing this on the simulator. Perhaps that's why it doesn't work solidly. I have a custom UICollectionViewListCell. Some times, quite often, the cell remains after I swipe to delete. However, the cell is inoperative. Sometimes, the cell selects and slides over, but there appears to be two cells in one spot and the cell does not delete and is still operational. Here's my current code with some of it commented out because I am easter-egging a solution.
config.trailingSwipeActionsConfigurationProvider = { [weak self] indexPath in
guard let self = self else { return nil }
if indexPath.row > 0 {
let cell = self.dataSource.collectionView(self.collectionView, cellForItemAt: indexPath) as! SavedVacationCell
let vacation = cell.vacation!
print("Going to delete it.")
let actionHandler: UIContextualAction.Handler = { action, view, completion in
action.image = UIImage(systemName: "trash")
// var snap = self.dataSource.snapshot()
// snap.deleteItems([vacation])
// self.dataSource.apply(snap, animatingDifferences: true)
if vacation.uuid!.count == 36 {
self.vacations?.removeAll(where: {$0.uuid == vacation.uuid})
var snap = self.dataSource.snapshot()
snap.deleteAllItems()
self.setSnapshot()
// self.loadSavedData()
// self.saveDataToAppleWatch()
}
self.deleteVacationAndReload(vacation)
completion(true)
}
let action = UIContextualAction(style: .destructive, title: "Delete", handler: actionHandler)
action.image = UIImage(systemName: "trash.fill")
action.backgroundColor = .systemRed
return UISwipeActionsConfiguration(actions: [action])
}
return nil
}
I'm sure I am doing something wrong. if anybody has a better solution or the correct solution, I'd like to know about it.
Thanks.
I am using the new multi-column UISplitViewController. I have a tab bar controller set as the view controller when in compact mode. I have a view in compact mode which displays a UIDatePicker in the new .inline style. Two tableview cells segue to that date picker view. I go into the date picker view and get a date. The problem seems to happen when I change the month of the date picker. When I return from the date picker view and then go back in for another date, I get the following in my console.
[CompositionalLayout] Invalid absolute dimension, must be > 0.0. NOTE: This will be a hard-assert soon, please update your call site.
I have no idea what this is. My layout is good.
I'm trying to put a swipe action on a UICollectionView cell of type UICollectionViewListCell. I get the error that
'Value of type 'UICollectionViewListCell' has no member 'leadingSwipeActionsConfiguration'. That's ridiculous because it does have said member. Below is my code. Can anybody tell me what I'm doing wrong?
let plainRegistration = UICollectionView.CellRegistration<UICollectionViewListCell, Vacation> { (cell, indexPath, vacation) in
var content = cell.defaultContentConfiguration()
content.text = "Just a normal cell"
cell.contentConfiguration = content
let actionHandler: UIContextualAction.Handler = { action, view, completion in
print("The action is done!")
completion(true)
}
let action = UIContextualAction(style: .destructive, title: "Delete", handler: actionHandler)
action.image = UIImage(systemName: "checkmark")
action.backgroundColor = .systemGreen
cell.leadingSwipeActionsConfiguration = UISwipeActionsConfiguration(actions: [action])
}
Here is my code currently. The problem is that the beige background color is there even when I select the cell. I know I should set a different background configuration for every state that I need to, but I don't know how for this default cell. I have created custom UICollectionViewListCells and set a different background on those depending on state. But can't figure out how to do that with the default cells.
let cellRegistration = UICollectionView.CellRegistration<UICollectionViewListCell, CellItem> { (cell, indexPath, cellItem) in
var content = cell.defaultContentConfiguration()
content.text = cellItem.title
content.secondaryText = cellItem.subText
if let imageName = cellItem.imageName {
content.image = UIImage(named: imageName)
}
cell.contentConfiguration = content
cell.accessories = [.disclosureIndicator()]
var backgroundConfig = UIBackgroundConfiguration.listGroupedCell()
/* Set a beige background color to use the cell's tint color. */
backgroundConfig.backgroundColor = UIColor(named: "CellColor")
backgroundConfig.strokeColor = .green
cell.backgroundConfiguration = backgroundConfig
}