Post not yet marked as solved
I need a Swift function to obtain the Magic Mouse battery level. I am working on an app to display the battery level in the Status Bar. I have the Status Bar code working.
Functions for the Wireless keyboard and Track Pad would also be helpful.
Post not yet marked as solved
Can someone translate this:
Details
SendProcessControlEvent:toPid: encountered an error: Error Domain=com.apple.dt.deviceprocesscontrolservice Code=8 "Failed to show Widget 'com.just.Memory-Widget.Free-Memory' error: Error Domain=FBSOpenApplicationServiceErrorDomain Code=1 "The request to open "com.apple.springboard" failed." UserInfo={NSLocalizedFailureReason=The request was denied by service delegate (SBMainWorkspace)., BSErrorCodeDescription=RequestDenied, NSUnderlyingError=0xac8a1f810 {Error Domain=SBAvocadoDebuggingControllerErrorDomain Code=1 "Failed to get descriptors for extensionBundleID (com.just.Memory-Widget.Free-Memory)" UserInfo={NSLocalizedDescription=Failed to get descriptors for extensionBundleID (com.just.Memory-Widget.Free-Memory)}}, FBSOpenApplicationRequestID=0x9949, NSLocalizedDescription=The request to open "com.apple.springboard" failed.}." UserInfo={NSLocalizedDescription=Failed to show Widget 'com.just.Memory-Widget.Free-Memory' error: Error Domain=FBSOpenApplicationServiceErrorDomain Code=1 "The request to open "com.apple.springboard" failed." UserInfo={NSLocalizedFailureReason=The request was denied by service delegate (SBMainWorkspace)., BSErrorCodeDescription=RequestDenied, NSUnderlyingError=0xac8a1f810 {Error Domain=SBAvocadoDebuggingControllerErrorDomain Code=1 "Failed to get descriptors for extensionBundleID (com.just.Memory-Widget.Free-Memory)" UserInfo={NSLocalizedDescription=Failed to get descriptors for extensionBundleID (com.just.Memory-Widget.Free-Memory)}}, FBSOpenApplicationRequestID=0x9949, NSLocalizedDescription=The request to open "com.apple.springboard" failed.}., NSUnderlyingError=0xac8a1f660 {Error Domain=FBSOpenApplicationServiceErrorDomain Code=1 "The request to open "com.apple.springboard" failed." UserInfo={NSLocalizedFailureReason=The request was denied by service delegate (SBMainWorkspace)., BSErrorCodeDescription=RequestDenied, NSUnderlyingError=0xac8a1f810 {Error Domain=SBAvocadoDebuggingControllerErrorDomain Code=1 "Failed to get descriptors for extensionBundleID (com.just.Memory-Widget.Free-Memory)" UserInfo={NSLocalizedDescription=Failed to get descriptors for extensionBundleID (com.just.Memory-Widget.Free-Memory)}}, FBSOpenApplicationRequestID=0x9949, NSLocalizedDescription=The request to open "com.apple.springboard" failed.}}}
Domain: DTXMessage
Code: 1
User Info: {
DVTErrorCreationDateKey = "2022-11-04 16:37:45 +0000";
}
System Information
macOS Version 12.5 (Build 21G72)
Xcode 14.1 (21534.1) (Build 14B47b)
Timestamp: 2022-11-04T09:37:45-07:00
Post not yet marked as solved
Xcode 14.1,
iOS 16.1,
MacOS 12.5,
Working on a Lock Screen widget with home screen widget.
This code:
struct Battery_LevelEntryView : View {
@Environment(\.widgetFamily) var widgetFamily
var entry: Provider.Entry
var body: some View {
switch widgetFamily{
case .systemSmall:
...
case ... :
If I include the .systemSmall case, each time I run the app
on the iPhone, it adds an additional home screen widget,
rather than replacing the first home screen widget.
Post not yet marked as solved
I am creating a widget using WidgetKit to display the iPhone battery level.
I setup the following timeline to update the widget very minute. (I use one minute
for testing the app. Once it works I'll use five minutes to preserve resources.)
In the "View" I display the time and battery level. The time is updated every minute.
However, the battery level does not get updated.
func getTimeline(in context: Context, completion: @escaping (Timeline) -> ()) {
var entries: [SimpleEntry] = []
let currentDate = Date()
let updateInterval = 1
for minuteOffset in stride(from: 0, to: 60, by: updateInterval ) {
let entryDate = Calendar.current.date( byAdding: .minute, value: minuteOffset, to: currentDate )!
let entry = SimpleEntry( date: entryDate )
entries.append(entry)
}
let timeline = Timeline(entries: entries, policy: .atEnd)
completion(timeline)
} // func
var body: some View {
let _ = UIDevice.current.isBatteryMonitoringEnabled = true
let batteryLevel = UIDevice.current.batteryLevel
VStack {
Text(entry.date, style: .time)
let str = String( format: "%.0f%%", batteryLevel * 100.0 )
Text( str )
}
} // some View
Post not yet marked as solved
When I print a UIImage using AirPrint, the image is scaled to fill the page (8.5 x 11 ). How can I scale the image to a smaller size?
Post not yet marked as solved
Mac Pro (Late 2013)MacOS: 10.14.6Memory 32GBXcode: 10.2.1iPhone: 6siOS: 12.4iPhone Memory: 16GBFree System Memory: 1.53GBFree RAM Memory: 429MBThe Provisioning Profiles and Certificates are all up-to-date.The Provisioning Profile is managed by Xcode.I can run an App in the simulator. When the App exits, its icon appears on the home screen.When I run the same App on the iPhone, it runs OK. When I exit the App there is noicon on the home screen.If I go to: Settings -> General -> iPhone Storage, the App name appears with theamount of storage used by the App.As a test. I deleted an existing App from the iPhone (its icon was on the home screen). When I reinstalled the App, it ran but there was no icon on the home screen.