I've been playing around with ARKit and I am interested in the orientation of ARGeoAnchor, ARImageAnchor and ARFaceAnchor. First of all, I notice that Apple says that ARGeoAnchor is based on an East-North-Up orientation, with its x- and z-axes matching the longitude and latitude directions. This should actually be characterized as an East-Up-South orientation (see https://developer.apple.com/documentation/arkit/arconfiguration/worldalignment/gravityandheading). I created an image to illustrate my point.
It's the ferry building. Referring to the ARKit 4 presentation (wwdc20-10611), one can see that the 'Ferry Building' label is initially facing south and needs to be rotated by approximately -51.4 degrees about the y axis in order to face in the proper direction. As far as ARImageAnchor is concerned, it appears to me that the coordinate system is as in the below image.
This is surprising to me as I would have expected it to be x to the right, y pointing up in the image and z pointing out of the image. It appears that ARPlaneAnchor's orientation is the same as ARImageAnchor. As far as ARFaceAnchor is concerned, its orientation is clearly explained in https://developer.apple.com/documentation/arkit/arfaceanchor and the orientation seems consistent to me.
I wish that the other anchors were explained as well. Anyway, feel free to chime in with corrections and comments.
Post
Replies
Boosts
Views
Activity
I think that there is a mistake in the Wayfinder watch face for Apple Watch Ultra. Note that in my picture, longitude shows '-81.54327 W', but because W is used, longitude should be either 81.54327 W or just -81.54327.
This is probably a simple question, but how can one have scrolling in one's Apple Watch app like that in the Workout App using SwiftUI? The scrolling which emphasizes each item as it scrolls by. I'm trying to recall, but can't.
Running watchOS 9.0.1 and Xcode 14.0.1. Also running iOS 16.0.2. Trying to run my code on the new Apple Watch Ultra and this is what I get (see below). Rebooted everything. Still no go.
Failed with HTTP status 403: forbidden
I have a project where I am upgrading my Apple Watch app to use SwiftUi and the SwiftUI lifecycle. For some reason, my destination views are missing the back button (<) and the navigation title. It all works fine with NavigationView, but I definitely want to go to NavigationStack and use the new API.
I have a number of 'AttributeGraph: cycle detected through attribute' console messages. On a whim, I commented out the two ScrollViews which I have in the app and the messages stopped. I set a symbolic breakpoint at 'print_cycle' to break when the attribute graph cycle is detected. Sure enough, the ScrollView has become the first responder.
#5 0x0000000184488a1c in ___lldb_unnamed_symbol120650 ()
#6 0x00000001849efd94 in ___lldb_unnamed_symbol168748 ()
#7 0x00000001849ed128 in ___lldb_unnamed_symbol168728 ()
#8 0x00000001849ec26c in ___lldb_unnamed_symbol168655 ()
#9 0x00000001849ec400 in ___lldb_unnamed_symbol168660 ()
#10 0x0000000184baa210 in ___lldb_unnamed_symbol185453 ()
#11 0x0000000184baa260 in ___lldb_unnamed_symbol185454 ()
#12 0x00000001a277ed60 in -[UIResponder _setFirstResponder:] ()
#13 0x00000001a2b29d38 in -[UIView _setFirstResponder:] ()
#14 0x00000001a277ed50 in -[UIResponder _setFirstResponder:] ()
#15 0x00000001a2b29d38 in -[UIView _setFirstResponder:] ()
#16 0x00000001a2ad55ac in -[UIScrollView _becomeFirstResponder] ()
I can't remove the ScrollViews, so I wonder if there is anything I can do about this.
I created a very simple project with a NavigationStack and a NavigationLink as follows.
Code 1.
NavigationLink("Go To Next View", value: "TheView")
.navigationDestination(for: String.self) { val in
Text("Value = \(val)")
}
This code works fine in the simple project. But when I put this simple code into my existing app's project using a NavigationStack, it navigates to the next view fine, but there is no back button. I am updating my Apple Watch target to use SwiftUI and I want to use NavigationStack.
My app does use @ObservedObject and my important data is using @Publish in a singleton class which conforms to ObservableObject. But this NavigationLink code, Code 1, is extremely simple and should work fine, but it does not.
The same problem happens with the following code.
Code 2
NavigationLink { NextView() } label: {
MainRowView(rowText: "Saved")
}
When I switch to NavigationView, Code 1 is grayed out, but Code 2 works fine and has a back button. However, as you know, NavigationView is being deprecated, so I really need to fix this or have it fixed. I can't see how this could be a problem with my code as the code snippet is so simple and worked in the simple project.
I'm getting this when I go to Accounts on Xcode and click on why Apple ID. I'm getting this on the current version and latest beta of Xcode. It's very disheartening. Anybody know what causes this?
I've created a simple project which uses CloudKit to store an attributed text as Bytes (Data)
The attributed text includes an image with an orange tint color. In my simple project, I have two labels, one for the attributed text which I am loading into CloudKit (putLabel) and one for the attributed text created from the CloudKit data record (getLabel). The putLabel shows the orange image correctly, but the getLabel with attributed text downloaded from the iCloud data shows it as a black image. No tint color. Anybody have any ideas on how to get an attributed text with tint color from CloudKit?
Here's the archive code
\\ Convert into Data
data = try? NSKeyedArchiver.archivedData(withRootObject: mainString, requiringSecureCoding: false)
and here's the unarchiver code
newStr = try? NSKeyedUnarchiver.unarchivedObject(ofClass: NSMutableAttributedString.self, from: data)
The code snippets are missing some things, but they work.
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.
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?