Posts

Post marked as solved
1 Replies
434 Views
When loading screen, I scan for tips: private lazy var scanAreaTipTask = Task { @MainActor in for await shouldDisplay in scanAreaTip.statusUpdates { if shouldDisplay == .available { onSetBeacon.send(.scanArea(scanAreaTip, .show)) } else { onSetBeacon.send(.scanArea(scanAreaTip, .hide)) scanAreaTipFinished = true } } } Task is called in ViewDidAppear of the UIViewController. First time I load this view controller, the scanAreaTip.statusUpdates always comes back as pending. If I quit this view controller and open it again, the scanAreaTip.statusUpdates will come back as available. Why does it always come back as pending on the first opening where it should come back as available? This is the tip that I am using. As shown, there aren't any rules or options used. Just a plain tip that should show straight away. public struct ScanAreaTip: Tip { public init() {} public var title: Text { Text("Scan area around you") .brandFont(style: .regular(.headline)) .foregroundStyle(Color.accentColor) } }
Posted
by jmgawe.
Last updated
.
Post marked as solved
2 Replies
495 Views
when using Tips with UIKit, presenting TipUIPopoverViewController disables all the buttons from the presenting screen. I assume this is the expected behaviour but is there a way to disable it? I would like the button that the tip is pointing to to be still enabled. Otherwise user has to tap on it twice which is not ideal. Method checking for tip's eligibility. private extension MenuViewController { func activateTips() { Task { @MainActor [weak self] in guard let self else { return } for await shouldDisplay in createMapTip.shouldDisplayUpdates { if shouldDisplay { let controller = TipUIPopoverViewController(createMapTip, sourceItem: createMapButton) { [weak self] action in if action.id == "LearnAboutMaps" { if self?.presentedViewController is TipUIPopoverViewController { self?.dismiss(animated: true) { self?.createMapTip.invalidate(reason: .actionPerformed) self?.viewModel.handle(.didTapLearnMoreAboutMaps) } } } } present(controller, animated: true) } else if presentedViewController is TipUIPopoverViewController { dismiss(animated: true) } } } } }
Posted
by jmgawe.
Last updated
.
Post not yet marked as solved
1 Replies
1k Views
I am trying to run the application on the iPad M1 Device pinned to the Xcode debugger. The scheme has the Replay data enabled with the film prerecorded from the very same iPad M1. Errors: 2022-09-19 19:21:52.790061+0100 ARPathFinder[1373:320166] ⛔️⛔️⛔️ ERROR [MOVReaderInterface]: Error Domain=com.apple.AppleCV3DMOVKit.readererror Code=9 "CVAUserEvent: Error Domain=com.apple.videoeng.streamreaderwarning Code=0 "Cannot grab metadata. Unknown metadata stream 'CVAUserEvent'." UserInfo={NSLocalizedDescription=Cannot grab metadata. Unknown metadata stream 'CVAUserEvent'.}" UserInfo={NSLocalizedDescription=CVAUserEvent: Error Domain=com.apple.videoeng.streamreaderwarning Code=0 "Cannot grab metadata. Unknown metadata stream 'CVAUserEvent'." UserInfo={NSLocalizedDescription=Cannot grab metadata. Unknown metadata stream 'CVAUserEvent'.}} ⛔️⛔️⛔️ 2022-09-19 19:21:54.103813+0100 ARPathFinder[1373:320166] [Session] ARSession <0x104f77ec0>: did fail with error: Error Domain=com.apple.arkit.error Code=101 "Required sensor unavailable." UserInfo={NSLocalizedDescription=Required sensor unavailable., NSLocalizedFailureReason=A required sensor is not available on this device.} Any help will be appreciated, thanks.
Posted
by jmgawe.
Last updated
.
Post not yet marked as solved
0 Replies
666 Views
Restoring "larger" ARWorldMap causes the app to crash. I am saying larger because the very same map saved earlier, with fewer anchors and feature points, does not crash and maps properly. It seems that the size of the ARWorldMap may make a difference or rather the amount of tracked anchors and feature points. I am not sure what made the exact difference but here is the ARWorldMap object and its specs: <ARWorldMap: 0x281c0cb40 center=(3.393822 0.345988 7.653722) extent=(21.671013 7.832555 20.250080) | 130 anchors, 9326 features> Tracking data: 20.4 MB The ARWorldMap is correctly fetched from the memory and passed to the configuration:  if let map = retrieveMap() {     configuration.initialWorldMap = map } The app crashes precisely before it correctly maps the surroundings.     func session(_ session: ARSession, cameraDidChangeTrackingState camera: ARCamera) {         switch session.currentFrame?.worldMappingStatus {         case .some(.mapped):             print("found") // Never executes with the "faulty" map         default:             print("problem")         }     } My situation seems to be related to this thread but not entirely. https://developer.apple.com/forums/thread/702596
Posted
by jmgawe.
Last updated
.
Post not yet marked as solved
0 Replies
682 Views
Using move(to:) method to update Entity's position works only if I don't use the the initialiser with duration parameter. sphere.move(to: newTransform, relativeTo: nil, duration: 0.75) // Absolutely no effect sphere.move(to: newTransform, relativeTo: nil) // Instant effect Both called from the Main thread. I don't understand what may cause this strange behaviour.
Posted
by jmgawe.
Last updated
.
Post not yet marked as solved
2 Replies
1.6k Views
Hi everyone. I am a self-taught iOS developer for around a year and a half. It's going really great so far. But there is nothing that interests me more than AR-related/ Rendering technologies. I am learning by myself about RealityKit, SceneKit, ARKit. Surely it doesn't go fast, but it goes somehow. Don't want to mention the Metal, that one goes really slow. Is anyone able to recommend some courses/ teachings not only about these techs specifically but also about some fundamental knowledge that I could possess to make that learning a little more efficient? When working with Entities and their position, it's clear that I am missing fundamental math. I've searched for some courses about Algebra/Trigonometry but there is a ton of it, and I'm not quite sure which ones should I pick to follow the AR path. I've got all the possible notes from WWDCs about RealityKit/ARKit. But it's not enough. Metal WWDCs are simply too complicated for me at this level. I am trying to catch on to some C++ in my spare time but there is little time left for that. I would highly appreciate your help. Thanks
Posted
by jmgawe.
Last updated
.
Post not yet marked as solved
1 Replies
1k Views
I am trying and trying to make my Entity move towards some previously described destination. The entity moves on a microlevel over and over again but never reaches its destination. DestinationSystem checks with its update function if the Entity is close enough so it can choose a new destination for it. I kindly ask you for help as I am absolutely out of ideas. Here is my DestinationSystem's update function. This system will only chose the current destination for the entity and then checks if the entity reached it. func update(context: SceneUpdateContext) {         let walkers = context.scene.performQuery(Self.query)         walkers.forEach({ entity in             guard var walker = entity.components[DestinationComponent.self] as? DestinationComponent,                   let _ = entity.components[MotionComponent.self] as? MotionComponent else { return }             defer {                 entity.components[DestinationComponent.self] = walker             }             // set the default destination to 0             var distanceFromDestination: Float = 0             // check if walker component for this specific entity has any destination             if let destination = walker.destination {                 // distract distance from it                 distanceFromDestination = entity.distance(from: destination)             }             // check if the distance still is. If its tiny, then lets choose another distance             if distanceFromDestination < 0.02 {                 var fixedDestination = SIMD3<Float>.spawnPoint(from: entity.transform.translation, radius: 0.7)                 fixedDestination.y = Float(0)                 // If there is any obstacle on the way to the destination, set that obstacle as the destination so it wont pass it, perhaps through the wall                 let obstacles = context.scene.raycast(                     from: entity.position,                     to: fixedDestination,                     query: .nearest,                     mask: .sceneUnderstanding,                     relativeTo: nil                 )                 if let nearest = obstacles.first {                     fixedDestination = nearest.position                     fixedDestination.y = Float(0)                 }                 walker.destination = fixedDestination             }         })     } Here is my MotionSystem. Constant variable s calculates current translation to cross and multiplies it by the deltaTime of the context and 0.03 which I choose as a speed.     func update(context: SceneUpdateContext) {         context.scene.performQuery(Self.query).forEach { entity in             let fixedDelta: Float = Float(context.deltaTime)             guard let _ = entity.components[MotionComponent.self] as? MotionComponent,                   let walker = entity.components[DestinationComponent.self] as? DestinationComponent             else { return }             var newTransform = entity.transform             let s = (walker.destination! - entity.transform.translation) * 0.03 * fixedDelta             newTransform.translation = s             newTransform.translation.y = Float(0)             entity.move(to: newTransform, relativeTo: entity.parent)         }     } I believe it should take my Entity frame by frame to the destination point, then choose another one. It never will again. Unless my math is terribly off? Thank you for any help.
Posted
by jmgawe.
Last updated
.
Post marked as Apple Recommended
8.1k Views
I am testing iOS15 and some new functionalities of UIKit. I've encountered some issues, not sure how to solve them. I did not change that code. This is just a piece of code that worked perfectly with the iOS 14, now after updating my target, it throws an error. Xcode crashes the moment when my custom header for the UICollectionView of type UICollectionElementKindSectionHeader is being returned for the dataSource. Here is my code: private func configureDataSource() { dataSource = UICollectionViewDiffableDataSource<Section, Follower>(collectionView: collectionView, cellProvider: { (collectionView, indexPath, followers) -> UICollectionViewCell? in let cell = collectionView.dequeueReusableCell(withReuseIdentifier: FollowerCell.reuseId, for: indexPath) as! FollowerCell cell.set(on: followers) return cell }) dataSource.supplementaryViewProvider = { (collectionView, kind, indexPath) in let header = collectionView.dequeueReusableSupplementaryView(ofKind: UICollectionView.elementKindSectionHeader, withReuseIdentifier: FollowersCollectionHeaderView.reuseId, for: indexPath) as! FollowersCollectionHeaderView header.set(with: self.user) return header } } The log says: the view returned from -collectionView:viewForSupplementaryElementOfKind:atIndexPath: does not match the element kind it is being used for. When asked for a view of element kind 'FollowersCollectionHeaderView' the data source dequeued a view registered for the element kind 'UICollectionElementKindSectionHeader'. I did cast UICollectionElementKindSectionHeader to FollowersCollectionHeaderView, therefore I am not sure what is the issue here. I've watched WWDC21 what's new in UIKit but haven't seen any mentioning of any change for that particular code. Any suggestions, what to fix in that code?
Posted
by jmgawe.
Last updated
.
Post not yet marked as solved
0 Replies
854 Views
Hello everyone, I am learning about ARKit, SceneKit, etc. To deeply understand SceneKit, I wanted to go through that video. Sadly, when clicked, it takes me nowhere. I cannot find that video through the Developer app either. Anyone happened to know what may be the reason for that? Thanks
Posted
by jmgawe.
Last updated
.
Post not yet marked as solved
0 Replies
951 Views
Hello everyone, I am getting that error all the time: Communication with Apple failed. Your maximum App ID limit has been reached. You may create up to 10 App IDs every 7 days. I haven't build a single application on my phone for a quite long time. It says 10 App IDs every 7 days. What could be wrong? thanks
Posted
by jmgawe.
Last updated
.
Post marked as solved
3 Replies
1.3k Views
Hello everyone, I've got my project written in Objective-C. I am learning about bridging. I bridged successfully Swift into my Objective-C project. I did some VC pushing between Objective-C VC and Swift VC. Everything works as it supposed to. However, I created the reference to my Objective-C NetworkManager (I used Singleton pattern) in my Swift file like that: let networkManager = NetworkManager.sharedManager() For some reason I cannot use methods from it. networkManager.getUserInfo() // .getUserInfo() will not appear! Just to show you how I've created my NetworkManager as a Singleton. I found that solution online and it was quite old, if you have any better solution, I would be more than happy to get some insight: (id)sharedManager { static NetworkManager *sharedMyManager = nil; static dispatch_once_t onceToken; dispatch_once(&amp;onceToken, ^{ sharedMyManager = [[self alloc] init]; }); return sharedMyManager; } (id)init { if (self = [super init]) { someProperty = @"Default Property Value"; self.cache = [[NSCache alloc] init]; } return self; } Not sure what is the issue here. Thank you all for the help.
Posted
by jmgawe.
Last updated
.
Post not yet marked as solved
1 Replies
818 Views
Hey guys. I am looking for some workflow for designing elements and animation so I can translate it later into a code in SwiftUI. Could you recommend something? I am looking for something that is a graph pad-like and allows using bezier functions etc. Many thanks for help!
Posted
by jmgawe.
Last updated
.
Post not yet marked as solved
0 Replies
1.1k Views
Hey guys. Cut to the chase. Trynna create some cells in my CollectionView. Cells will populate with the object of type Tweet. Some Tweet(s) has urlToExpand, some has value nil. Based on that, button "See more" will be visible or nah. I am certain that the data is passed correctly into Cell as I have checked it with the print. However button works randomly. Sometimes it does display, sometimes it doesn't. I have no idea why. Here is my dataSource update in VC private func configureDataSource() { &#9;&#9;&#9;&#9;dataSource = UICollectionViewDiffableDataSource<Section, Tweet>(collectionView: collectionView, cellProvider: { (collectionView, indexPath, tweet) -> UICollectionViewCell? in &#9;&#9;&#9;&#9;&#9;&#9;let cell = collectionView.dequeueReusableCell(withReuseIdentifier: SearchTweetsCell.reuseId, for: indexPath) as! SearchTweetsCell &#9;&#9;&#9;&#9;&#9;&#9; &#9;&#9;&#9;&#9;&#9;&#9;cell.set(with: tweet, user: self.user) &#9;&#9;&#9;&#9;&#9;&#9;cell.delegateSafari = self &#9;&#9;&#9;&#9;&#9;&#9; &#9;&#9;&#9;&#9;&#9;&#9;return cell &#9;&#9;&#9;&#9;}) &#9;&#9;&#9;&#9; &#9;&#9;&#9;&#9;dataSource.supplementaryViewProvider = { (collectionView, kind, indexPath) in &#9;&#9;&#9;&#9;&#9;&#9;let header = collectionView.dequeueReusableSupplementaryView(ofKind: UICollectionView.elementKindSectionHeader, withReuseIdentifier: SearchTweetsVCCollectionHeader.reuseId, for: indexPath) as! SearchTweetsVCCollectionHeader &#9;&#9;&#9;&#9;&#9;&#9;header.set(with: self.user) &#9;&#9;&#9;&#9;&#9;&#9;return header &#9;&#9;&#9;&#9;} &#9;&#9;} Here is the function from collectionViewCell that I am calling in my cv while populating cells. func set(with usersTweet: Tweet, user: User) { &#9;&#9;&#9;&#9;self.user&#9;&#9;&#9;&#9;&#9;&#9;&#9;&#9;&#9;&#9;&#9;&#9;&#9;&#9;&#9; = user &#9;&#9;&#9;&#9;tweet&#9;&#9;&#9;&#9;&#9;&#9;&#9;&#9;&#9;&#9;&#9;&#9;&#9;&#9;&#9;&#9;&#9; = usersTweet &#9;&#9;&#9;&#9;urlString&#9;&#9;&#9;&#9;&#9;&#9;&#9;&#9;&#9;&#9;&#9;&#9;&#9;&#9;&#9; = usersTweet.urlToExpandWithSafari &#9;&#9;&#9;&#9;tweetBodyLabel.text&#9;&#9;&#9;&#9;&#9;&#9;&#9;&#9;&#9;&#9; = usersTweet.tweetText &#9;&#9;&#9;&#9;timeDateLabel.text&#9;&#9;&#9;&#9;&#9;&#9;&#9;&#9;&#9;&#9;&#9;= usersTweet.createdAt.formatToTwitterPostDate() &#9;&#9;&#9;&#9; &#9;&#9;&#9;&#9;sharesView.set(itemInfoType: .shares,&#9; with: usersTweet.retweetCounter.convertToKMFormatStr()) &#9;&#9;&#9;&#9;likesView.set(itemInfoType: .likes,&#9;&#9; with: usersTweet.likesCounter.convertToKMFormatStr()) &#9;&#9;&#9;&#9; &#9;&#9;&#9;&#9;guard tweet.urlToExpandWithSafari != nil else { &#9;&#9;&#9;&#9;&#9;&#9;DispatchQueue.main.async { self.goSafariButton.removeFromSuperview() } &#9;&#9;&#9;&#9;&#9;&#9;goSafariButton.isEnabled = false &#9;&#9;&#9;&#9;&#9;&#9;return &#9;&#9;&#9;&#9;} &#9;&#9;&#9;&#9;DispatchQueue.main.async { self.goSafariButton.setTitle(TweetStrings.seeFull, for: .normal) } &#9;&#9;} Many thanks for any help.
Posted
by jmgawe.
Last updated
.
Post not yet marked as solved
11 Replies
1.6k Views
Hey guys. I am having an issue with one of my projects. UICollectionViewCell in my UICollectionView has a plus button with the systemImage "plus". When clicked, its changing to systemImage "checkmark". The issue is, clicking one button, changes UI for every fifth cell. On top of that, animation does not finish. Alpha goes to 0, and then the image is being changed, alpha should go to 1 but never gets there. It stops somewhere between 0.7-0.8. Here is my animation block: private func animateButtonView(_ viewToAnimate: UIView) {         UIView.animate(withDuration: 0.2, animations: {viewToAnimate.alpha = 0}) { [weak self] (true) in             guard let self = self else { return }             switch true {             case true:                 DispatchQueue.main.async { self.addToFavoritesButton.setImage(SFSymbolsAsImg.checkmark, for: .normal) }                 UIView.animate(withDuration: 0.2, animations: {viewToAnimate.alpha = 1} )             case false:                 return             }         }     } Animation block is executed in my objective function that is called in addTarget for a button. I've asked that question on many forums and got not much. I'll appreciate any help. Many thanks!
Posted
by jmgawe.
Last updated
.