Apple Developers

RSS for tag

This is a dedicated space for developers to connect, share ideas, collaborate, and ask questions. Introduce yourself, network with other developers, and foster a supportive community.

Learn More

Posts under Apple Developers subtopic

Post

Replies

Boosts

Views

Activity

Displaying limited contacts list in UIKit
I have an app that was written in UIKit. It's too large, and it would be much too time consuming at this point to convert it to SwiftUI. I want to incorporate the new limited contacts into this app. The way it's currently written everything works fine except for showing the limited contacts in the contact picker. I have downloaded and gone though the Apple tutorial app but I'm having trouble thinking it through into UIKit. After a couple of hours I decided I need help. I understand I need to pull the contact IDs of the contacts that are in the limited contacts list. Not sure how to do that or how to get it to display in the picker. Any help would be greatly appreciated. func requestAccess(completionHandler: @escaping (_ accessGranted: Bool) -> Void) { switch CNContactStore.authorizationStatus(for: .contacts) { case .authorized: completionHandler(true) case .denied: showSettingsAlert(completionHandler) case .restricted, .notDetermined: CNContactStore().requestAccess(for: .contacts) { granted, error in if granted { completionHandler(true) } else { DispatchQueue.main.async { [weak self] in self?.showSettingsAlert(completionHandler) } } } // iOS 18 only case .limited: completionHandler(true) @unknown default: break } } // A text field that displays the name of the chosen contact @IBAction func contact_Fld_Tapped(_ sender: TextField_Designable) { sender.resignFirstResponder() // The contact ID that is saved to the Db getTheCurrentContactID() let theAlert = UIAlertController(title: K.Titles.chooseAContact, message: nil, preferredStyle: .actionSheet) // Create a new contact let addContact = UIAlertAction(title: K.Titles.newContact, style: .default) { [weak self] _ in self?.requestAccess { _ in let openContact = CNContact() let vc = CNContactViewController(forNewContact: openContact) vc.delegate = self // this delegate CNContactViewControllerDelegate DispatchQueue.main.async { self?.present(UINavigationController(rootViewController: vc), animated: true) } } } let getContact = UIAlertAction(title: K.Titles.fromContacts, style: .default) { [weak self] _ in self?.requestAccess { _ in self?.contactPicker.delegate = self DispatchQueue.main.async { self?.present(self!.contactPicker, animated: true) } } } let editBtn = UIAlertAction(title: K.Titles.editContact, style: .default) { [weak self] _ in self?.requestAccess { _ in let store = CNContactStore() var vc = CNContactViewController() do { let descriptor = CNContactViewController.descriptorForRequiredKeys() let editContact = try store.unifiedContact(withIdentifier: self!.oldContactID, keysToFetch: [descriptor]) vc = CNContactViewController(for: editContact) } catch { print("Getting contact to edit failed: \(self!.VC_String) \(error)") } vc.delegate = self // delegate for CNContactViewControllerDelegate self?.navigationController?.isNavigationBarHidden = false self?.navigationController?.navigationItem.hidesBackButton = false self?.navigationController?.pushViewController(vc, animated: true) } } let cancel = UIAlertAction(title: K.Titles.cancel, style: .cancel) { _ in } if oldContactID.isEmpty { editBtn.isEnabled = false } theAlert.addAction(getContact) // Select from contacts theAlert.addAction(addContact) // Create new contact theAlert.addAction(editBtn) // Edit this contact theAlert.addAction(cancel) let popOver = theAlert.popoverPresentationController popOver?.sourceView = sender popOver?.sourceRect = sender.bounds popOver?.permittedArrowDirections = .any present(theAlert,animated: true) } func requestAccess(completionHandler: @escaping (_ accessGranted: Bool) -> Void) { switch CNContactStore.authorizationStatus(for: .contacts) { case .authorized: completionHandler(true) case .denied: showSettingsAlert(completionHandler) case .restricted, .notDetermined: CNContactStore().requestAccess(for: .contacts) { granted, error in if granted { completionHandler(true) } else { DispatchQueue.main.async { [weak self] in self?.showSettingsAlert(completionHandler) } } } // iOS 18 only case .limited: completionHandler(true) @unknown default: break } } // MARK: - Contact Picker Delegate extension AddEdit_Quote_VC: CNContactPickerDelegate { func contactPicker(_ picker: CNContactPickerViewController, didSelect contact: CNContact) { selectedContactID = contact.identifier let company: String = contact.organizationName let companyText = company == "" ? K.Titles.noCompanyName : contact.organizationName contactNameFld_Outlet.text = CNContactFormatter.string(from: contact, style: .fullName)! companyFld_Outlet.text = companyText save_Array[0] = K.AppFacing.true_App setSaveBtn_AEQuote() } } extension AddEdit_Quote_VC: CNContactViewControllerDelegate { func contactViewController(_ viewController: CNContactViewController, shouldPerformDefaultActionFor property: CNContactProperty) -> Bool { return false } func contactViewController(_ viewController: CNContactViewController, didCompleteWith contact: CNContact?) { selectedContactID = contact?.identifier ?? "" if selectedContactID != "" { let company: String = contact?.organizationName ?? "" let companyText = company == "" ? K.Titles.noCompanyName : contact!.organizationName contactNameFld_Outlet.text = CNContactFormatter.string(from: contact!, style: .fullName) companyFld_Outlet.text = companyText getTheCurrentContactID() if selectedContactID != oldContactID { save_Array[0] = K.AppFacing.true_App setSaveBtn_AEQuote() } } dismiss(animated: true, completion: nil) } }
2
0
734
Jun ’25
privaterelay
Hello, I have a problem, I need to receive a letter to a hidden email, this is a very long story, so I will tell you if it is really necessary, but that is not the point: how to find a letter sent to PrivateRelay. appleid.com/
1
0
314
Dec ’24
In iOS 18, using AudioUnit for audio recording, converting PCM format to AAC crashes the application.
`// PCM -> AAC AudioBufferList* convertPCMToAAC (XDXRecorder *recoder) { UInt32 maxPacketSize = 0; UInt32 size = sizeof(maxPacketSize); OSStatus status; status = AudioConverterGetProperty(_encodeConvertRef, kAudioConverterPropertyMaximumOutputPacketSize, &size, &maxPacketSize); // log4cplus_info("AudioConverter","kAudioConverterPropertyMaximumOutputPacketSize status:%d \n",(int)status); AudioBufferList *bufferList = (AudioBufferList *)malloc(sizeof(AudioBufferList)); bufferList->mNumberBuffers = 1; bufferList->mBuffers[0].mNumberChannels = _targetDes.mChannelsPerFrame; bufferList->mBuffers[0].mData = malloc(maxPacketSize); bufferList->mBuffers[0].mDataByteSize = kTVURecoderPCMMaxBuffSize; AudioStreamPacketDescription outputPacketDescriptions; UInt32 inNumPackets = 1; pthread_mutex_lock(&pcmBufferMutex); status = AudioConverterFillComplexBuffer(_encodeConvertRef, encodeConverterComplexInputDataProc, pcm_buffer, &inNumPackets, bufferList, &outputPacketDescriptions); pthread_mutex_unlock(&pcmBufferMutex); if(status != noErr){ // log4cplus_debug("Audio Recoder","set AudioConverterFillComplexBuffer status:%d inNumPackets:%d \n",(int)status, inNumPackets); free(bufferList->mBuffers[0].mData); free(bufferList); return NULL; } if (recoder.needsVoiceDemo) { OSStatus status = AudioFileWritePackets(recoder.mRecordFile, FALSE, bufferList->mBuffers[0].mDataByteSize, &outputPacketDescriptions, recoder.mRecordPacket, &inNumPackets, bufferList->mBuffers[0].mData); // log4cplus_info("write file","write file status = %d",(int)status); if (status == noErr) { recoder.mRecordPacket += inNumPackets; } } return bufferList; } ` The above code for converting PCM to AAC works normally in iOS versions below 18, but in iOS 18, crashes occur during the conversion process. The console does not provide much useful information, and the application crashes at malloc(maxPacketSize) or AudioConverterFillComplexBuffer(), displaying the message AURemoteIO::IOThread (14): EXC_BAD_ACCESS (code=1, address=0x0). Please help identify the cause of the crash.
1
0
346
Oct ’24
IOS 18 BETA FEEDBACK
I have seen lots of complaints about the phone app and how things don’t run as smoothly, and stuff about the shade of the tapback feature icons. I personally have been struggling with replying now that I can’t just double tap. I also don’t like that when I pull down on a message, I can’t copy the messages anymore. I have to use Duo Mobile for school, and my mom will sometimes log in to help with my loan, and I have to have a code to log her in, it used to be easy to just pull down and copy but now have to go into messages. Very small inconveniences, and I will eventually be able to get used to them once they become habit, but I’d rather not have to adapt lol.
0
0
237
Nov ’24
Issue on booting - "SODC report detected: AP watchdog expired"
Not sure if I am in the right place, directed here by apple support staff. On starting my MacBook Pro M3 Max this morning it went into a cycle of rebooting after about 1-2 mins. I managed to see the following error message "SODC report detected: AP watchdog expired" before the screen went totally black and the fans went to full speed. Any thoughts on this? Sequoia 15.2, no external drives or hardware plugged in. Thanks
0
0
471
Nov ’24
Apple ACME client failing to poll order when order is in "processing" status.
I'm developing an ACME server to issue identity certificates to macOS/iOS devices for MDM attestation, following RFC 8555. Per RFC, the client creates an order, performs authorization, verifies the challenge, and finalizes the order by submitting a CSR to the CA. In my setup, the CA sometimes takes longer to issue the certificate (around 50 seconds). According to RFC 8555, if certificate issuance isn’t complete after the /finalize call, the server should respond with an "order" object with a "processing" status. The client should then send a POST-as-GET request to the order resource (e.g., /order/<order_id>) to check the current state. If the CA still hasn’t issued the certificate, the server should return the order object with the same "processing" status and include a "Retry-After" header, indicating when the client should retry. The client is expected to poll the order resource at this specified interval with POST-as-GET requests. However, it seems the Apple ACME client ignores the "Retry-After" header and instead returns the error: "Profile failed - Order status is processing, not yet valid" immediately upon the first poll response with "processing." Apple ACME client deviating from the RFC documentation. Has anyone found a reliable solution to this issue? Ref -https://datatracker.ietf.org/doc/html/rfc8555#:~:text=A%20request%20to%20finalize%20an%20order%20will%20result%20in%20error,to%20the%20%22certificate%22%20field%20of%20the%20order.%20%20Download%20the%0A%20%20%20%20%20%20certificate. To work around this, I’m holding the /finalize call until the CA issues the certificate. This works when issuance is quick (under 20 seconds), but if it takes more than that , the client times out. Interestingly, the Apple ACME client’s timeout appears shorter than the usual 60-second URLSession default.
0
0
468
Oct ’24
IOS 18.2 Beta Issues
i was update my iPhone 15 pro max on IOS 18.2 beta versio. I am fasing the issu. When i am playing Pubg Game, the notification always Come down and game stop. And when i try to On “Guided Access” the Guided access also not workin. Plzzz fix it. And i have another issue with iPhone when i open any app or any documents its very difficult to Go Back. i have to use left hand to go back or always Use Both hands. If it’s possible the “Go Back” option is available on both left and right side. right hander also easily use iPhone on One hand. give us a option “Go Back” option on Right also. Its very easy for us. Thank u soo much🩷🩷
1
0
584
Nov ’24
iPhone bootloop full storage
Hello, I have an iPhone 15 Pro Max. This morning, the phone suddenly restarted and has since remained stuck on the Apple logo, with no progress bar displayed. The phone's storage is completely full. It has been several hours, and I am unsure how to resolve this. This phone is provided by my workplace and contains highly important, irreplaceable data. Losing this data would have serious consequences, as there is no way for me to recreate it. So far, I have tried charging the phone and using iTunes with the "Update" option, but the process failed. I am aware that there might be a way to access the data even in this bootloop stage, but I need guidance on how to proceed to avoid any data loss.
0
0
180
Nov ’24
The Future of Native Development
Hello, Apple Developer Community, In recent years, I've found myself increasingly concerned about the future of native ecosystems (iOS, Android), and I'd like to share my thoughts with you. It seems that small startups and cost-conscious companies are increasingly opting for cross-platform technologies like React Native, Flutter, and WebView, aiming to reduce expenses and speed up development cycles. Even large companies are following this trend in many cases. While this approach may be efficient from a business perspective, can it truly match the quality of user experience (UX) provided by native interfaces? Personally, I don't believe it does. There are undeniable advantages to cross-platform (or web-based) development, including rapid deployment and quick updates, as well as the ability to incorporate user feedback without going through a review process at every iteration. However, from my experience, once the initial version of a product has been somewhat stabilized, most companies tend to stick with cross-platform rather than transitioning to native development. In South Korea, where I am based, interest in native development education and entry-level training is on the decline. Most students and educational institutions favor frontend or backend development, and even mobile development curricula often prioritize cross-platform approaches. If this trend continues, we may face a shortage of native developers in the long run, which could lead companies to fall back on cross-platform solutions. This cyclical trend raises questions about whether a career in native development will continue to hold its advantages. On the surface, Apple appears invested in maintaining and expanding the native ecosystem. However, in practice, I feel that support for startups and smaller businesses trying to approach native development has been limited. I believe platform providers like Apple should place more focus on sustaining this ecosystem by providing practical, accessible support. (Perhaps including something as extreme as requiring a minimum percentage of native development?) I'm curious to hear what other developers in the community, particularly those who work extensively with Apple platforms, think about this shift. I'd appreciate hearing a variety of perspectives on this topic. Thank you.
0
0
268
Oct ’24