Welcome to the Apple Developer Forums

Post your questions, exchange knowledge, and connect with fellow developers and Apple engineers on a variety of software development topics.

For questions about using Apple hardware and services, visit Apple Support Communities

Posts

Sort by:
Post not yet marked as solved
0 Replies
1 Views
Hi, I'm trying to convert my SceneKit code into pure Metal/MetalKit and I feel confused about this code and how I should rewrite it. I've made the code simple for this case with some pseudocode. The part where it says "SceneKit magic" is where I feel lost. The SCNNode is just an empty placeholder just as it is – and it works for the calculations it is doing inside. Any help and pointers are much appreciated :-) class Scene { let ball = Ball() let scnNode = SCNNode() var quaternionAngleVelocity = float2(0, 0) func update() { // pseudocode, the user press the up key quaternionAngleVelocity.x -= 3 // pseudocode, the user press the down key quaternionAngleVelocity.x += 3 // pseudocode, the user press the left key quaternionAngleVelocity.y -= 3 // pseudocode, the user press the right key quaternionAngleVelocity.y += 3 ... // apply friction quaternionAngleVelocity *= (1 - 0.05) // i.e. decrease with 5% // rotate let newQuaternionAxisX = simd_quatf(angle: quaternionAngleVelocity.x.degreesToRadians, axis: simd_float3(x: 1, y: 0, z: 0)) let newQuaternionAxisY = simd_quatf(angle: quaternionAngleVelocity.y.degreesToRadians, axis: simd_float3(x: 0, y: 1, z: 0)) let finalQuaternion = simd_normalize(newQuaternionAxisX * newQuaternionAxisY) // SceneKit magic…? let matrix4 = SCNMatrix4Mult(scnNode.worldTransform, SCNMatrix4(simd_float4x4(finalQuaternion))) scnNode.transform = matrix4 ball.quaternion = scnNode.simdWorldOrientation } } class Ball { var position: float3 = [0, 0, 0] var rotation: float3 = [0, 0, 0] { didSet { let rotationMatrix = float4x4(rotation: rotation) quaternion = simd_quatf(rotationMatrix) } } var scale: float3 = [1, 1, 1] var forwardVector: float3 { return normalize([sin(rotation.y), 0, cos(rotation.y)]) } var rightVector: float3 { return [forwardVector.z, forwardVector.y, -forwardVector.x] } var upVector: float3 { return [0, forwardVector.z, 0] } var quaternion = simd_quatf() var modelMatrix: float4x4 { let translateMatrix = float4x4(translation: position) // let rotateMatrix = float4x4(rotation: rotation) let rotateMatrix = float4x4(quaternion) let scaleMatrix = float4x4(scaling: scale) return (translateMatrix * rotateMatrix * scaleMatrix) } var worldTransform: float4x4 { return modelMatrix } }
Posted
by
MKX
Post not yet marked as solved
0 Replies
8 Views
I'm using Original API for In-App Purchase, I'm working with auto-renewable subscription, I don't use receipts and server. I want to retrieve the date of each auto-renew subscription when purchases are restored. According to documentation, I should use transaction.originalTransaction.transactionDate. But when I test in SandBox, I notice that transaction.originalTransaction.transactionDate refers to first subscription transaction and so it is always the same value for each auto-renew subscription. In the other hand, I notice that transaction.transactionDate is the correct date I'm looking for. So my question is : should I rely on what I get in my SandBox tests and consider that production environment will have the same behaviour?
Posted
by
Post not yet marked as solved
0 Replies
5 Views
We have a suite of UI tests managed by QA. They are developed on his machine (M1 MacBook Pro) and when they all pass he checks in We use fastlane and an M1 Mac-mini as our build machine/pipeline. When the tests are running in the pipeline we always get swipe failures such as XCTAssertTrue failed - Failed to swipe so not on the correct page XCTAssertTrue failed - Swipe not worked, delete not showing And so on. What I find really strange is I can login to the build machine itself, open the project from the source directory and manually run all the UI Tests - they all pass. I also ran the fastlane lane directly (ui_tests) from terminal to exactly mimic what the pipeline does and they all pass As soon as I re-enable them in the full pipeline (fast file) we get the swipe failures on the same machine and emulator! The only difference I can see is I ran them directly / standalone versus part of the pipeline. Also, they run immediately after our unit tests unit_tests ui_tests Could this potentially affect things? From reading around I wondered about the M1 architecture potentially being the cause but they are written on an M1 and the build machine is the same architecture (and as above, in isolation they work) Any ideas appreciated!
Posted
by
Post not yet marked as solved
1 Replies
8 Views
Hello! How can we change the locale in DateFormatter auotmatic or dynamically? I need to set in English or Spanish depends on the user language... let formatter = DateFormatter() formatter.dateStyle = .long formatter.locale = Locale(identifier: "es_ES") return formatter.string(from: date) I’m trying in the simulator in spanish and without the Locale identifier keeps in english, also in real devices. Thanks!
Posted
by
Post not yet marked as solved
0 Replies
9 Views
Recently I updated my device OS to the iOS16 version and observed one discrepancy in the native PHPhotoPicker Component in my application. In the Previous version (i.e iOS 15.3), PHPhotoPicker inherits the application's navigation bar color (screenshot attached for reference) However, In the iOS 16 version, PHPhotoPicker's navigation bar color does not change according to the application theme, And PHPhotoPicker displays with its default UI (screenshot attached for it)
Posted
by
Post not yet marked as solved
0 Replies
10 Views
We have implemented swipe to delete with confirmation introduced in iOS15 and now when we start showing confirmation Dialog in iOS16.1 Beta 4, the app crashes apparently when internally [UISwipeOccurrence _executeLifecycleForPerformedAction:sourceView:completionHandler:] is called. Here is the code simplified:        List {         ForEach(items, id: \.self) { item in           ItemView(item: item)             .swipeActions {               Button(role: .destructive) {                 itemToDelete = item                 showDeleteConfirmation = true               } label: {                 Image(systemName: "trash")               }             }         }       }       .confirmationDialog(deleteConfirmationTitle,                 isPresented: $showDeleteConfirmation,                 titleVisibility: .visible) {         Button(role: .destructive) {           if let itemToDelete {             withAnimation {               model.delete(itemToDelete)             }           }         } label: {           Text("Delete")         }         Button(role: .cancel) {         } label: {           Text("Cancel")         }       } Appreciate any ideas and feedback.
Posted
by
Post not yet marked as solved
2 Replies
20 Views
Hi, I want to display a sheet bound to an object using .sheet(item: $someObject content: <#T##(Identifiable) -> View#>) However if item is a class we can't use @StateObject var someObject: SomeObject? because an optional cannot conform to observable object. As I don't have any changing property and do not need the view to be refreshed once passed to the sheet I used @State and it seems to be working fine. Here is a minimal example of what I'm doing. import SwiftUI class SomeObject: Identifiable {   let id = 1   let content = "Hello world" } class SomeObjectStore {   static let shared = SomeObjectStore()   var objects = [SomeObject()]   private init() {} } struct ContentView: View {   @State private var someSheetPresentedObject: SomeObject?   var body: some View {     Button("Open view") {       someSheetPresentedObject = SomeObjectStore.shared.objects.first     }     .sheet(item: $someSheetPresentedObject) { someObject in       Text(someObject.content)     }   } } It seems okay because SwiftUI only needs to know if there is a reference to someSheetPresentedObject or not to present the sheet. I know that the Text won't be updated if SomeObject.content changes but I'm only displaying it once so it's not an issue. My question is: is it okay to do this for this specific case ?
Posted
by
Post not yet marked as solved
1 Replies
16 Views
Hi all, I worked on an app that shows a list of events from a website. I have all the rights to use their data, in fact they are a client of mine. But for some reason Apple wants me to be an organization instead of an individual. Has this happened to any of you before? I have no idea why I NEED to be an organization as I have another app that does similar things. Thanks in advance for any advice.
Posted
by
Post not yet marked as solved
1 Replies
26 Views
I work for a company that has a few apps in the store that me and my team develop and maintain. However, they now want to also release a handful of apps developed by third parties. They have tasked me with finding out what the best way to do this is. But I am having a really hard time finding even a single method that is supported by Apple. So far I have mostly focussed on: Having them build an ipa/xcarchive and sign it with a dev certificate, them sending the ipa/xcarchive to me and me resigning it with our distribution certificate I have tried to do this with our own app, but I get dozens of signing errors when I try to transport it to TestFlight. Adding some from the external developers to our Team in AppStoreConnect and having them upload a build signed with a dev certificate. Followed by us somehow promoting this dev build to a production build. So in essence this would mean resigning the app inside AppStoreConnect; I don’t know if this is possible. But it would be a nice solution. I have read some forum posts hinting at this, but I haven’t been able to find any documentation on it. Giving the external developers our distribution certificate (and ipa key); This has been all but ruled out by the company, for fear of it leaking and messing with our main apps. Having the external developers provide me with access to their source code, so that I am in control of the whole build process and can do so with the right certificates. Understandably, the external developers don’t want to give us access to their source code. Can someone advise me on a way forward? We would strongly prefer a way that is supported by Apple, where we don’t have to make any compromises on security with regards to certificates and keys. Thanks in advance!
Posted
by
Post not yet marked as solved
0 Replies
12 Views
Hello everyone! I've faced this issue: using AutoreleasingUnsafeMutablePointer with XCode >= 14 and Release configuration causes EXC_BAD_ACCESS. However, with Debug or XCode 13.4.1 app works just fine... Original post here - https://forums.swift.org/t/swift-5-7-using-autoreleasingunsafemutablepointer-leads-to-exc-bad-access/60688
Posted
by
Post not yet marked as solved
2 Replies
19 Views
I am building an app that saves the view as an image. I am trying to use the ImageRenderer to do that. But when I type it in, it says it cannot find ImageRenderer in scope. How do I fix this to use ImageRenderer?
Posted
by
Post not yet marked as solved
0 Replies
18 Views
A few of our users reported that images saved with our apps disappear from their library in Photos after a few seconds. All of them own a Mac with an old version of macOS, and all of them have iCloud syncing enabled for Photos. Our apps use Core Image to process images. Core Image will transfer most of the input's metadata to the output. While we thought this was generally a good idea, this seems to be causing the issue: The old version of Photos (or even iPhoto?) that is running on the Mac seems to think that the output image of our app is a duplicate of the original image that was loaded into our app. As soon as the iCloud sync happens, the Mac removes the image from the library, even when it's in sleep mode. When the Mac is turned off or disconnected from the internet, the images stay in the library—until the Mac comes back online. This seems to be caused by the output's metadata, but we couldn't figure out what fields are causing the old Photos to detect the new image as duplicate. It's also very hard to reproduce without installing an old macOS on some machine. Does anyone know what metadata field we need to change to not be considered a duplicate?
Posted
by
Post not yet marked as solved
0 Replies
19 Views
Hello everyone, I'd like to post this so the issue becomes known to the Apple team and developers. I believe this information is very valuable for the company and would improve the lives of multiple customers around the globe and people wouldn't have to experiment with unknown 3rd party tools and possibly compromise their data. I've talked about this to a Senior Advisor and I was recommended to leave a post and feedback about this issue. In this post I'll be talking about Data Recovery possibility for a lot of people who encounter "Error 1110" in iTunes. What causes Error 1110 (common)? User takes up all of the storage space available on the iOS device. Software begins to malfunction or in my case begins to update overnight leading to a catastrophic failure. Device not booting. What is Error 1110? Device doesn't have enough storage space to boot or update. Only option available is "Restore" via iTunes. Device is stuck in a bootloop or constantly boots into Recovery Mode. iTunes isn't able to "Update" the device due to the following sample error: <key>AMRError</key> <integer>1110</integer> <string>Upgrade Install failed(ENOSPC) TotalSpace: 122070 MB InitialFreeSpace: 1675 MB FreeSpaceAfterCleanup: 1675 InitialDataVolumeUsage: 113289 MB DataVolumeUsageAfterCleanup: 113289 MB RequiredAdditionalSpace: 5956 MB </string> Consequences of this issue are as follows: Unable to boot device to retrieve data such as: Photos, Videos, etc... Forces customer or user to perform a software reset via iTunes. I'd like to point out that I've ran into loads of devices with Error 1110 including my own. This has been happening way more ever since iOS 10 release. In the last 4 years I've tried many repair shops and asked around for solutions to no avail. So I ended up digging deeper into this and found hundreds of posts around the web with people running into this issue. Reached out to numerous repair shops to see how often this occurs and it looks like it's a constant issue. So I took the time to investigate and come up with some solutions. Solutions that would help: Create a signed iOS copy every single time a new iOS releases. The copy would be a iOS (Light) version with all of the current security features but without system apps such as: Camera, Safari, Calendar, etc... However, it would be important that we do not allow downgrading these versions publicly either due to security reasons. So each release there would be 2 iOS versions. For example, we could implement the following: iOS 16.0.2 & iOS 16.0.2 (Light). This would definitely guarantee a fix for majority of people. In addition, this light iOS version could perform slight repairs to the current OS. The idea behind it is similar to a safe boot. Allow customers to send out their devices to Apple repair for a fee in order to downgrade iOS version that isn't being signed in order to successfully update device and repair the firmware. Afterwards, upload customers data to iCloud and reset the device. Why would this solution work? because lower iOS versions require less storage space and the chances of data retrieval increase. I personally like the first option as it would allow users to repair their devices from home. The second solution could be a temporary fix. However, second option doesn't necessarily guarantee data retrieval or a fix to the problem. Please let me know of what you guys think and if you have any suggestions. Feel free to reach out to me with questions as I've experimented with a load of such devices. Couple devices I've managed to fix for others but sadly haven't been able to fix mine as the storage situation is more severe on mine. There are people who lost years worth of information and so did I.
Posted
by
Post not yet marked as solved
0 Replies
19 Views
Is there any other way to update the live activities besides using push notifications when the app is in background? Is it possible to schedule an update, for example? For context, I have a live activity that needs the content updated 2 hours after it's creation. I know that the best way to do it is using a push notification, but right now I don’t have the resources to implement this. I already tried using BackgroundTasks, but they are not very reliable, so I can't trust it.
Posted
by
Post not yet marked as solved
1 Replies
21 Views
In iOS 16.1 betas, when setting the MusicPlayer Queue with a radio station, it no longer plays the station and instead starts playing first song from Music Library. While I’ve already filed the bug report via Feedback Assistant, I’m writing this post because it a critical bug that must be fixed before iOS 16.1 gets released and I think it’s getting close to release. So, I hope this gets fixed in the upcoming beta. FB11678404 CC @JoeKun
Posted
by
Post not yet marked as solved
2 Replies
21 Views
Hi, We have developed a VPN app, we recently received feedback from some iOS 16 users that VPN connections cannot be established, We found that PacketTunnel's network request fails, but requesting the same site in the main app works fine, the Wireless Data settings for the application are set to allow WLAN &amp; Cellular Data. Network requests use NSURLSession. After analysis, we think this may be a problem caused by network permissions on the App extension, and it returns to normal after restarting the phone. Seems to only appear on Chinese version devices, iOS 16.0, iOS 16.0.2 versions have similar feedback. Error log: Error Domain=NSURLErrorDomain Code=-1009 "似乎已断开与互联网的连接。" unsatisfied (Path was denied by NECP policy), interface: pdp_ip0[lte], ipv4, ipv6, expensive ERROR: &lt;PacketTunnelProvider:(454)&gt; API request failed: Error Domain=NSURLErrorDomain Code=-1009 "似乎已断开与互联网的连接。" UserInfo={_kCFStreamErrorCodeKey=50, NSUnderlyingError=0x1047674c0 {Error Domain=kCFErrorDomainCFNetwork Code=-1009 "(null)" UserInfo={_NSURLErrorNWPathKey=unsatisfied (Path was denied by NECP policy), interface: pdp_ip0[lte], ipv4, ipv6, expensive, _kCFStreamErrorCodeKey=50, _kCFStreamErrorDomainKey=1}}, _NSURLErrorFailingURLSessionTaskErrorKey=LocalDataTask &lt;6602B486-A9E4-4B73-9D56-5BC4F49F5495&gt;.&lt;1&gt;, _NSURLErrorRelatedURLSessionTaskErrorKey=( "LocalDataTask &lt;6602B486-A9E4-4B73-9D56-5BC4F49F5495&gt;.&lt;1&gt;" ), NSLocalizedDescription=似乎已断开与互联网的连接。, NSErrorFailingURLStringKey=***, NSErrorFailingURLKey=***, _kCFStreamErrorDomainKey=1}
Posted
by

Pinned Posts

Categories

See all