Post not yet marked as solved
I want to use the "SFProDisplay-Bold" font in iOS project but without adding the font files in the project as this font file is 2.2 MB and it increases the App size.
To see what the default system font is, added the below code in our iOS project:
var systemFont = UIFont.SystemFontOfSize(20, UIFontWeight.Bold).Name;
Debug.WriteLine($"System: {systemFont.FamilyName}");
This above code gave output from our project as follows -> System: .AppleSystemUIFont and the systemFont is ".SFUI-Bold" .
I believe that SFUI and SF Pro Display are different fonts(correct me if wrong)
Need more clarity for ways on how to implement specific font "SF Pro Display".
Post not yet marked as solved
We try to get notification history records with endpoint below:
https://developer.apple.com/documentation/appstoreserverapi/get_notification_history
but it returns no data , example of return:
{"notificationHistory":[],"hasMore":false}
our app still using the server notification V1, It it we can't get data from the api as long as we don't upgrade to v2?
please help, thanks
Post not yet marked as solved
I had a timer app, it played white noise after starting the timer. so my app is running in the background with background audio, and the timer is perfect for display with live activity.
However, when I test my code with a real device, I find calling await activity.update(using: contentState) when app is running in the background does not work at all. the code executes, but the live activity won't get updated.
After some experiments, I find:
if the app is running in the background with background location or Picture-in-picture mode, the app can update live activity when running in the background.
If the app is running in the background with audio playing, it will work on simulator, but not on a real device.
I submit a feedback: FB11683922 (Can't update Live Activity from app with ActivityKit when app is running in the background with background audio playing.)
My code is like:
func startLiveActivity() {
// Prepare content state and attributes.
do {
self.activity = try Activity.request(attributes: activityAttributes, contentState: initialContentState)
// Play audio so app can keep running in the background.
try playAudio()
} catch (let error) {
print("Error requesting Live Activity \(error.localizedDescription).")
}
}
private func playAudio() throws {
try AVAudioSession.sharedInstance().setCategory(.playback, options: .mixWithOthers)
try AVAudioSession.sharedInstance().setActive(true)
if self.player == nil {
if let url = Bundle.main.url(forResource: "Forest", withExtension: "m4a") {
player = try AVAudioPlayer(contentsOf: url)
player?.numberOfLoops = -1
}
}
player?.stop()
player?.currentTime = 0
player?.play()
}
after the timer stops, the code will execute, but the live activity won't get updated.
func updateActivity(){
Task {
if let activity = self.activity {
// Prepare content state
await activity.update(using: contentState)
}
}
}
Post not yet marked as solved
We are using CNSaveRequest in CNContactStore to add contacts to system device contacts. But when calling execute method the app crashing in internal libraries.The code was working fine until macOS Monetery, In macOS Ventura beta we are facing this issue.
Sample Code:
let store = CNContactStore()
store.requestAccess(for: .contacts, completionHandler: { isSuccess,error in
guard isSuccess else {
return
}
let contact = CNMutableContact()
contact.familyName = "Hello"
contact.givenName = "Contact"
let request = CNSaveRequest()
request.add(contact, toContainerWithIdentifier: nil)
do {
try store.execute(request)
}
catch {
print(error)
}
})
Crash:
Hey guys
I'm trying to follow along with the WWDC session titled "What's new with SwiftUI". They say it's possible to have the detail view of a NavigationSplitView be determined based on a state variable by using the following code:
However, and I'm kinda going crazy here, this code does NOT work on iOS whatsoever, the view will remain the one determined by "default" Switch case.
It works fine on macOS, but iOS (and iPadOS) simply will not change the detail view no matter what.
I have tried working around it for hours but it seems to boil down to the view never being redrawn... has anyone tried this? Is this just a iOS bug??
Post not yet marked as solved
I'm testing my App in the Xcode 14 beta (released with WWDC22) on iOS 16, and it seems that AVSpeechSynthesisVoice is not working correctly.
The following code always returns an empty array:
AVSpeechSynthesisVoice.speechVoices()
Additionally, attempting to initialize AVSpeechSynthesisVoice returns nil for all of the following:
AVSpeechSynthesisVoice(language: AVSpeechSynthesisVoice.currentLanguageCode())
AVSpeechSynthesisVoice(language: "en")
AVSpeechSynthesisVoice(language: "en-US")
AVSpeechSynthesisVoice(identifier: AVSpeechSynthesisVoiceIdentifierAlex)
AVSpeechSynthesisVoice.speechVoices().first
Post not yet marked as solved
After WWDC 2022, apple was release Metal 3, a new version of their Graphics API,
I use Radeon Pro 560X GPU on my iMac 21.5 4K 2019, does my GPU support for Metal 3?
Can I get tickets to the wwdc if I am under 13?
Can I join the developer program without a legal business?
Can I enter the swift student challenge if i am under 13?
Post not yet marked as solved
When I try to watch the WWDC22 "Platforms State of the Union" video on my Apple TV, iPhone, or iPad, using the Developer app, the video only shows a single frame every few seconds and there is no audio. The video plays fine on the Developer app on my Mac.
Has anyone else had this problem? Is there a work around? (I've tried deleting the Developer app on my Apple TV and reinstalling it, but no joy).
Post not yet marked as solved
I'm using PDFKit to render a PDF and I have added custom menus using "UIMenuController". But it is now deprecated from iOS 16 onwards.
Any help would be really appreciated.
Thanks in Advance.
Post not yet marked as solved
Hi,i have been trying out SwiftUI Table and wanted to present a details view when click on Table Row occurs, but I couldn't figure out how to "deselect" row once its been selected, while it may not be what Table was intended for, but I still think this code should be valid. (iPadOS)
struct Person: Identifiable {
let givenName: String
let familyName: String
let emailAddress: String
let id = UUID()
}
private var people = [
Person(givenName: "Juan", familyName: "Chavez", emailAddress: "juanchavez@icloud.com"),
Person(givenName: "Mei", familyName: "Chen", emailAddress: "meichen@icloud.com"),
Person(givenName: "Tom", familyName: "Clark", emailAddress: "tomclark@icloud.com"),
Person(givenName: "Gita", familyName: "Kumar", emailAddress: "gitakumar@icloud.com")
]
@State private var selectedPeople: Person.ID?
@State private var detailsViewPresented: Bool = false
var body: some View {
Table(people, selection: $selectedPeople) {
TableColumn("Given Name", value: \.givenName)
TableColumn("Family Name", value: \.familyName)
TableColumn("E-Mail Address", value: \.emailAddress)
}
.onChange(of: selectedPeople) { selection in
guard selection != nil else {
return
}
detailsViewPresented = true
}
.sheet(isPresented: $detailsViewPresented, onDismiss: {
// Trying to reset the selection
self.selectedPeople = nil
}) {
Text("Person's details")
}
}
Here when I press row, it gets selected and Text is presented, but row still remains selected, and yes, I could just use onTapGesture within row content if I declared TableColumn with explicit content, but it would just be added to that column and would not provide build in selection style.
https://developer.apple.com/documentation/swiftui/table
Post not yet marked as solved
The new Virtualization framework (and sample code!) are great. It's a lot of fun to run the sample code and quickly fire up multiple VMs of macOS running as a guest.
However, the inability to authenticate with any iCloud services is a significant roadblock. Xcode, for example, is not allowing me to authenticate my developer account.
Are there any plans to resolve this issue so that iCloud accounts can be authenticated from within a VM?
Post not yet marked as solved
I want to use features described in the background assets WWDC22 session (https://developer.apple.com/videos/play/wwdc2022/110403/).
In earlier versions of Xcode 14 beta there used to be a background asset extension target type, however this got removed in beta 5 and has still not been put back even though Xcode 14 RC is released.
With Xcode 14 beta 4, if the background asset target was chosen then a bunch of template code was created, same as happens with any extension type.
But if the background asset extension target type isn't even present in the Xcode 14 RC, how is one supposed to create an extension and use this new feature?
Post not yet marked as solved
Is there a way to disable Stage Manager?
Other than enabling "Requires full screen".
Post not yet marked as solved
specifically:
https://www.macrumors.com/2022/06/15/ios-16-remove-subject-from-background/
Post not yet marked as solved
Using the example from WWDC, with the following command
./SignalGenerator -signal square -duration 3 -output ./uncompressed.wav I can generate an audio file, which is not playable, and its Get Info is:
Duration: 00:00
Audio channels: Mono
Sample rate: 44,1 kHz
Bits per sample: 32
Although for MacOS Preview the duration is zero, this file is playable in VLC and convertible to other formats, so its content is ok. To get more information about the format of an output file I changed the example to print outputFormatSettings:
["AVLinearPCMBitDepthKey": 32, "AVLinearPCMIsBigEndianKey": 0, "AVSampleRateKey": 44100, "AVFormatIDKey": 1819304813, "AVLinearPCMIsFloatKey": 1, "AVNumberOfChannelsKey": 1, "AVLinearPCMIsNonInterleaved": 1]
I don’t know how to interpret the “number of AVFormatIDKey": 1819304813. The documentation says:
let AVFormatIDKey: String -
For information about the possible values for this key, see Audio Format Identifiers
Having red this, I still don't know the relation of AVFormatIDKey and listed Audio Format Identifiers.
If I knew which file format to expect, it might have helped to guess why the duration of the generated files is always 0? Can you help me with both questions? Thanks.
Post not yet marked as solved
is there a way let develop know an m1 pad has connected an external display?
if this pad is not in mirror-display mode, can I show two different window from one app in two screens?
Post not yet marked as solved
while doing storyboard editings app is got crashed please repair it
Post not yet marked as solved
I'm working on an App Shortcut using the new AppIntents framework in iOS 16 and I'm trying to get the user's current location, everything is enabled and set-up correctly with the permissions
func perform() async throws -> some IntentResult {
//Request User Location
IntentHelper.sharedInstance.getUserLocation()
guard let userCoords = IntentHelper.sharedInstance.currentUserCoords else { throw IntentErrors.locationProblem }
//How to wait for location??
return .result(dialog: "Worked! Current coords are \(userCoords)") {
IntentSuccesView()
}
}
And here is the IntentHelper class
class IntentHelper: NSObject {
static let sharedInstance = IntentHelper()
var currentUserCoords: CLLocationCoordinate2D?
private override init() {}
func getUserLocation() {
DispatchQueue.main.async {
let locationManager = CLLocationManager()
locationManager.delegate = self
print("FINALLY THIS IS IT")
self.currentUserCoords = locationManager.location?.coordinate
print(self.currentUserCoords)
}
}
}
extension IntentHelper: CLLocationManagerDelegate {
func locationManager(_ manager: CLLocationManager, didFailWithError error: Error) {
print(error)
manager.stopUpdatingLocation()
}
}
Problem is, this sometimes, very rarely works, most of the times it prints nil, so how would you go about waiting for the location?
Post not yet marked as solved
Is it possible to see a preview of the Live Activity UI we design? For a regular widget, we pass in a WidgetPreviewContext modifier where we specify the size of the widget to preview. Is it possible to do something similar to see how the live activity would appear without having to run the app and then see how the live activity appears on the Lock Screen?