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 Answers
1 Views
It would be great to be able to build for Preview without having the SwiftUI Preview open. That way the preview will be ready without rebuilding when coming back to it. Any way to do that? Steps to reproduce: go to another file (not a view) like a view model implement some logic and compile a few time during the implementation go back to the preview, compilation take a lot of time because it now compile for another target I guess Solution: Add a shortcut in Product > Build For > Preview. That way I can compile for preview from anywhere easily.
Posted
by
Post not yet marked as solved
0 Answers
9 Views
I'm posting this here hoping somebody may have some ideas for solutions, or if they can point me to any useful resources. We want to be able to customise macOS installations created from the Virtualization framework for the purposes of driving automated testing of our software. In an ideal world these Virtual Machines become very much transitory, where they can be removed once they are finished with. My company writes security software for enterprise customers leveraging the Endpoint Security framework, and one of the ways in which we ease the pressure on our QA team during regression testing is to use a lot of automation. Given that the nature of automation testing is that you test systems against known configuration states, we have always made heavy use of Virtualized environments to ensure our test results are reliable. With the progression of macOS over time it has made it ever more difficult to reduce the amount of manual setup required to ensure the virtualized macOS installation is in a ready state to begin testing. For example, we currently have to join virtualized macs to an MDM server simply to be able to install configuration profiles that pre-authorize system extensions, or to send PPPC payloads to ensure our automation framework can work without the user having to manually approve PPPC requests for Accessibility access. We also then have to manually install the test harness in the virtualized mac as there is no way for us to mount the disk image after OS installation (you can almost do this, but you cannot unlock the APFS volume due to needing to know a passphrase to unlock said disk which I presume the Virtualization framework has safely stored somewhere in a Keychain on the host system) We would like some solution to being able to place configuration profiles in to a Virtualized mac (we would be happy for this to be available to Apple Silicon platform only, ignoring Intel) without having to involve an MDM, or as a next best thing, some way of instantiating the enrollment with an MDM from the host side, rather than the guest side, so that it behaves more similarly to DEP auto enrollment. As things stand right now, there is no possibility of us using what would be our preferred solution of an IaC style definition declaring software test suite, and OS version to be created to run the tests, because we always have to instantiate test hosts manually by joining them to an MDM to deploy configuration profiles, and to install the test runner.
Posted
by
Post not yet marked as solved
0 Answers
6 Views
How can I exchange information easily and securely between 2 apps on macOS? 1 of the app will infrequently request a short amount of data from the other one. Here are the options that I can see: DistributedNotificationCenter : very easy to implement. However, the notifications are broadcast to any apps that wants to listen to it, and apple's documentation clearly states that it's not secure. I would ideally like a mechanism that is as simple as this, but with a secure communication between 2 aps Apple Events. I am not sure how to make an app respond to apple event. And I think it would be the same problem : any other app could talk to these 2 apps and get information from them. I ideally want this to be more secure. XPC, this seems overly complex for what I want to do, as my understanding is that this essentially involves creating a third process that will regulate communication. Implementing IPC via sockets. It seems reasonable I think, as I can probably secure the communication better. However it feels over-enigneered to set up sockets that always listen for incoming connections, etc Am I missing a simple mechanism on macOS that could help me in that use case? Or am I looking at things incorrectly for one of these options? Thanks!
Posted
by
Post not yet marked as solved
0 Answers
15 Views
I have a Function addNote() that returns a value called 'idd' in the form of string Now I have a view called ListView where there is a navigationLink that essentially needs that returned 'idd' value to be passed to this view called NoteView which is that navigationLink's destination. However I'm not able to pass that value down to NoteView. I've been struggling with this for days now, I'd appreciate if someone could give me their two cents! Thanks a ton. here’s the listview code: ` structure ListView: View { @StateObject var dataManager = DataManager() @State var isPresented = false var body: some View { NavigationView { ZStack{ List(dataManager.notes) { note in NavigationLink(destination: NoteView(newNote: note.content, idd: note.id)) { EmptyView() Text(note.content)}.buttonStyle(PlainButtonStyle()) .frame(height: 0) .navigationTitle("Notes") .navigationBarItems( trailing: Button (action: {}, label: { NavigationLink(destination: NoteView(newNote: "", idd: "") ) {Image(systemName: "plus")} .simultaneousGesture(TapGesture().onEnded{ dataManager.addNote() })} )) .listStyle(.plain) .buttonStyle(PlainButtonStyle()) ‘ here’s the idd that addNote() returns: `class DataManager : ObservableObject { @Published var notes: [Note] = [] @Published var idd = "" func addNote()-> String{ let user = Auth.auth().currentUser let uid = Auth.auth().currentUser!.uid let db = Firestore.firestore() var ref: DocumentReference? = nil ref = db.collection("userslist").document(uid).collection("actualnotes").addDocument(data: ["content":"New Note"]) {error in if let error = error{ print(error.localizedDescription) } else { print("Document added with ID: \(ref!.documentID)") } } let idd = ref!.documentID return idd }`
Posted
by
Post not yet marked as solved
0 Answers
10 Views
The the enhancements to Xcode Previews in Xcode 14 are very helpful. I just had a situation where I wanted to take a screen capture of a preview of a view. Is there a built-in way to do that from Xcode, similar to taking a screen capture of the simulator screen? I realize I can just use a system-level screen capture, but then I have to adjust the size of what I capture to the area of the view in the preview. It would be great to just be able to have a button or shortcut and have the correct area captured.
Posted
by
Post not yet marked as solved
0 Answers
7 Views
Hi, I have a hardware connected to iPhone over bluetooth. Hardware sometimes send a UDP request which is being dropped if the app is in background. I found from all previous discussions that there is no way to handle UDP requests in background if the app is suspended. And our app doesn't qualify to keep the app in background forever. Is there any latest update or other suggested way to handle these UDP requests. How does Apple watch app handle such cases where a watch app sends a UDP request ? Thanks in advance
Posted
by
Post not yet marked as solved
0 Answers
12 Views
I've been getting at the precipitationAmount data using this hack from another thread. I've often found that the precip amount is 0mm for every hour of the day. Every entry for today has the same precipAmount of 0mm: HourWeather(date: 2022-06-27 22:00:00 +0000, cloudCover: 0.15, condition: Mostly Clear, symbolName: "sun.max", dewPoint: 12.43 °C, humidity: 0.78, isDaylight: true, precipitation: , precipitationChance: 0.0, precipitationAmount: 0.0 mm However the iOS 16 beta 2 weather app is showing precip data for today at the same location. Is the iOS 16 Weather App using the same WeatherKit as I am? I'm finding the data in weatherkit to be pretty different than the data in the weather app.
Posted
by
Post marked as solved
1 Answers
18 Views
It seems like the direction of the wind is reported in the direction it's heading vs the direction it's coming from. Most of the time in other weather products, wind is reported in the direction it's coming from. eg. A west wind is coming from the west (heading east) and would have a bearing of 90.0 ° (coming from the west) Am I correct in thinking that the below reported wind is actually a "West wind"? WeatherKit.Wind(compassDirection: East, direction: 90.0 °, speed: 7.09 km/h, gust: Optional(18.18 km/h))
Posted
by
Post not yet marked as solved
0 Answers
12 Views
Hi, When I import a USDZ from the RoomPlan demo code into Blender it results in no geometry. Xcode has no problem with the model, on the other hand, nor does Preview. Has anyone else had this issue? Apparently the Forum won't let me upload a model here.
Posted
by
Post not yet marked as solved
0 Answers
16 Views
Issue: Safari browser crashes consistently when I run a Selenium automation script for a very simple use case: Enter username & password and press the Sign in button. Browser crashes as soon as the button is clicked, before the home page loads up. Please refer to the attached js file for script and steps to reproduce. Also attaching Safari crash logs from ~/Library/Logs/DiagnosticReports/. Can see a segmentation fault had occurred with KERNEL_INVALID_ADDRESS due to bad memory area being accessed: "exception" : {"codes":"0x0000000000000001, 0x0000000000000040","rawCodes":[1,64],"type":"EXC_BAD_ACCESS","signal":"SIGSEGV","subtype":"KERN_INVALID_ADDRESS at 0x0000000000000040"}, "termination" : {"flags":0,"code":11,"namespace":"SIGNAL","indicator":"Segmentation fault: 11","byProc":"exc handler","byPid":48287}, Product Specs: MacOS Monterey version 12.2.1 Mac mini (2018) Processor: 3Ghz 6-Core Intel Core i5 Memory: 8GB 2667 MHz DDR4 Graphics: Intel UHD Graphics 640 1536 MB NOTE: Issue is NOT related to Selenium since this issue is only seen in Monterey only for particular product specs consistently. Did not face this in Big Sur/ Catalina/ Mojave/ High Sierra, etc. Also test runs fine in Chrome, Firefox & Edge browsers in the same machine. Crash may be reproducible only in some versions of Monterey with particular hardware configurations. This is an error related to segmentation fault due to bad memory access so it's pretty clear this has to be hardware dependent. Safari-2022-06-24-152240.txt reproduce_safari_crash.js
Posted
by
Post not yet marked as solved
1 Answers
21 Views
We encountered some order issue in recent 3 months. We were told some orders were false, while they were found the purchase processed successfully. We use https://buy.itunes.apple.com/verifyReceipt to check the order, but we can’t find it. But when we use https://api.storekit.itunes.apple.com/inApps/v1/lookup/ to check it, it returns that the user has finished the purchase. Anyone have this problem and how to solve it?
Posted
by
Post not yet marked as solved
0 Answers
19 Views
I am trying to add a UITableView element to a XIB which I want to present as a sheet from the bottom but I only get the option of static cells. Isn't it possible to have dynamic tables within a XIB or am I missing something?
Posted
by
Post not yet marked as solved
1 Answers
16 Views
We are trying to evaluate certificate trust chain in our macOS app. We are setting the certificate chain (Root and two Intermediate CA certificates) using SecTrustSetAnchorCertificates and then calling SecTrustEvaluateWithError. The result is success. Next time, we are calling SecTrustSetAnchorCertificates with one intermediate CA certificate missing in the certificate chain and then calling SecTrustEvaluateWithError for our server trust. The result is still success. Next, we are calling SecTrustSetAnchorCertificates with all intermediate certificates but missing Root CA in certificate chain and then calling SecTrustEvaluateWithError for our server trust. The result is false/unsuccessful. The first and third scenarios are expected. But how is trust evaluation successful when one of intermediate CA certificate is missing? Is macOS caching the intermediate CA certificates we have provided to SecTrustSetAnchorCertificates some other time and using it the next time when it is missing one of intermediate CA certificates since the documentation says intermediate CA certificates are looked up in different location including Among any certificates you previously provided by calling SecTrustSetAnchorCertificates(_:_:) but not the Root CA? If caching is the reason, is there a way we can clear cached intermediate CA certificates so that it only uses the certificate chain I provide in most recent call to SecTrustSetAnchorCertificates? I have already tried passing nil to SecTrustSetAnchorCertificates and then passing the certificate chain in subsequent call. The result is still a success. Note: All our Root and intermediate CA certificates are custom certificates and not available outside. We have also tried to set false in SecTrustGetNetworkFetchAllowed and result is still the same.
Posted
by
Post not yet marked as solved
1 Answers
28 Views
I have screen to register user. I have a post api for this. But I am not able to register the user. I don't understand where I went wrong. I would be glad if you help. MODEL: struct NewUserModel: Codable { let name: String? let address: String? let year: String? let email: String? let district: String? let phone: String? let repassword: String? let city: String? let password: String? let surname: String? let tcno: String? let city: String? } WebService Class class Webservice { func regisUser(email: String, password: String, repassword: String, name: String, surname: String, phone: String, year: String, city: String, country: String, district: String, address: String, tcno: String, completion: @escaping (Result<String, AuthenticationError>) -> Void) { guard let url = URL(string: "http://ec2-3-74-42-117.eu-central-1.compute.amazonaws.com:8080/api/insertuser") else { completion(.failure(.custom(errorMessage: "URL is not correct"))) return } var urlRequest = URLRequest(url: url) urlRequest.httpMethod = "POST" let request = NewUserModel(name: name, address: address, year: year, email: email, district: district, phone: phone, repassword: repassword, city: city, password: password, surname: surname, tcno: tcno, ulke: ulke) do { let requestBody = try JSONEncoder().encode(request) urlRequest.httpBody = requestBody urlRequest.addValue("application/json", forHTTPHeaderField: "content-type") }catch let error { debugPrint(error.localizedDescription) } URLSession.shared.dataTask(with: urlRequest) { (data, httpUrlResponse, error) in if(data != nil && data?.count != 0) { do { let response = try JSONDecoder().decode([NewUserModel].self, from: data!) print("Success") } catch let decodingError { debugPrint(decodingError) } } }.resume() } } When I press the register button, it does not register the user, but it prints success to the console. LoginPageViewModel     @Published var email: String = ""     @Published var password: String = ""     @Published var repassword: String = ""     @Published var name: String = ""     @Published var surname: String = ""     @Published var phone: String = ""     @Published var year: String = ""     @Published var city: String = ""     @Published var city: String = ""     @Published var district: String = ""     @Published var address: String = ""     @Published var tcno: String = "" func Register(){ Webservice().regisUser(email: email, sifre: sifre, resifre: resifre, ad: ad, soyad: soyad, phone: phone, dogumyili: dogumyili, ulke: ulke, sehir: sehir, ilce: ilce, adres: adres, tcno: tcno) { result in switch result { case .success(_): DispatchQueue.main.async { print("ok) } case .failure(let error): print(error.localizedDescription) } } } LoginPage View     @StateObject var loginData: LoginPageModel = LoginPageModel()  // Login Button...                     Button {                         if loginData.registerUser{                             loginData.Register()                         }                         else{                             loginData.Login()                         }
Posted
by
Post not yet marked as solved
0 Answers
21 Views
I’m transitioning my Mac app from paid upfront to freemium with an in-app purchase. The app in question has been available on the Mac App Store for quite some time, and it gained business customers who purchased it via the Volume Purchase Program. The grandfathering path for regular customers is straightforward. I can read out the original app version from the receipt and base the activation state on it, i.e. keep the app unlocked up to a particular original version and require an in-app purchase otherwise. However, since the VPP works differently and there’s no such information in the receipt, I was wondering what the recommended approach for grandfathering these customers is.
Posted
by
Post not yet marked as solved
1 Answers
19 Views
I realise this is a duplicate issue, but I think it's fair to continue to highlight what has been a problem for at lease the last 7 years now. https://developer.apple.com/forums/thread/5802 I have 150 users that agreed to beta test my app, but only about 30 installs as the whole TestFlight system has many issues which add so much friction to onboarding users. In todays environment, we need to make it as simple as possible for users to get on our apps, TestFlight does not help. Half the emails never arrive for random reasons and need to be resent When they do arrive, they end up in the spam folder. After they do get the email the TestFlight user experience is laborious to say the least. There must be a better way. One option is to use the public link, however my app is not ready for untrusted users otherwise I would simply publish to the App Store. If we could generate a single use link in App Store Connect this would fix all the issues, we could send a branded email with instructions from our own domain and avoid any spam filter problem. This link exists already, it is basically the link that is sent in the email we just need access to these unique links to send to our users. TestFlight allows up to 10000 users, I wonder how many apps have ever gotten more than 100 on there considering how poor the experience is and how poorly apple are supporting this. Again, there must be a better way.
Posted
by
Post not yet marked as solved
1 Answers
28 Views
My app is searching for few services which are running on my local network with NetServiceBrowser. As I am searching using _services._dns-sd._udp.local., I have requested and get the permission of com.apple.developer.networking.multicast (which has been discussed here ). I have created a provisioning profile with enabling multicast entitlement according to forum guide. But after that I still have to add Bonjour service types in Info.plist or else NetServiceBrowser throws ["NSNetServicesErrorCode": -72008, "NSNetServicesErrorDomain": 10]. <key>NSBonjourServices</key> <array>     <string>_mydummy._tcp</string>     <string>_services._dns-sd._udp</string> </array> Do I still have to add each service into info.plist although I have added multicast entitlement?
Posted
by
Learn More about - WWDC22.

Pinned Posts

Categories

See all