Post

Replies

Boosts

Views

Activity

NEHotspotNetwork BSSID missing first character?
please consider this code: [NEHotspotNetwork fetchCurrentWithCompletionHandler:^(NEHotspotNetwork *network) { if (network) { DebugLog(@"Network ssid: %@, bssid: %@", network.SSID, network.BSSID); } else { DebugLog(@"No available network"); } }]; For me, I have a strange situation - say that the BSSID of my network is "01:34:56:78:90" the string in the property is missing the first character! what is contains (and is printed) is "1:34:56:78:90" - the leading "0" is missing. So, I was wondering if this is a know thing, or if perhaps it's only Asus (my router)? Or, am I doing something wrong? Pointers would be much appreciated.
2
0
560
Sep ’23
Can't get SVG image to work in lockscreen widget
Hi, please consider the following widget view case .accessoryCircular: VStack{ Image(entry.icon).resizable().padding().border(.red) Text("IN") } EDIT, i also have tried this without success: Image(entry.icon).resizable().frame(height: gp.size.height * 0.30, alignment: .center) The image works if it's a PNG but now it's an SVG. I'm pretty much a SwiftUI noob, so i don't know how to get the image to work within the circular widget... or perhaps SVG isn't supported in lockscreen widgets? The error message i'm getting from the preview is The body of the Widget' entries contains an image of size(2094, 2010) which is beyond the maximum of (1418,8, 3067,2). That's a pretty strange error message to me, i thought the vstack would keep the image within the boundaries? also, I get the same message if i remove the text. Do i have to set the size explicitly?? In that case i have to hard-code it to some fixed widget size, right? I'd like to avoid that if possible. Grateful for pointers.
0
0
671
Oct ’22
Why can't i see my widget logs on device?
Hi, i have a separate question for the same widget here, so please look there for the source code. In the widget, you can see i have various print()-calls in the methods. On the simulator i can see the calls, however when i run on my phone, they are not visible anywhere. In xcode the log window closes (and opens up again if i run the app itself, not the extension), and i cannot find them in the console app either. Is this expected behavior or am i missing something? Thankful for pointers.
2
0
2.6k
Oct ’22
Why is my widget drawn twice?
Hi there, i have just made a widget, whoohoo! As you can see in the code below, it draws an icon and a random number. This works fine, however, i have noticed when running, that it is drawn twice every time. That is, first a number is shown, then a second later, it changes again. This seems unneccessary, and i don't understand why it happens. Hoping that someone can show me the light. Code: import SwiftUI import Intents struct Provider: IntentTimelineProvider {     func placeholder(in context: Context) -> WidgetEntry {         print(">>>> MyWidget;getTimeline")         return WidgetEntry(status: 0, date: Date(), configuration: ConfigurationIntent())     }     func getSnapshot(for configuration: ConfigurationIntent, in context: Context, completion: @escaping (WidgetEntry) -> ()) {         print(">>>> MyWidget;getSnapshot")         let entry = WidgetEntry(status: 0, date: Date(), configuration: configuration)         completion(entry)     }     func getTimeline(for configuration: ConfigurationIntent, in context: Context, completion: @escaping (Timeline<Entry>) -> ()) {         print(">>>> MyWidget;getTimeline")         let entry = WidgetEntry(status: 0, date: Date(), configuration: configuration)         let timeline = Timeline(entries: [entry], policy: .never)         completion(timeline)     } } struct WidgetEntry: TimelineEntry {     let status: Int     let date: Date     let configuration: ConfigurationIntent } struct WidgetView : View {     var entry: Provider.Entry          init(entry: Provider.Entry){         print(">>>> WidgetView;init()")         self.entry = entry;     }     var body: some View {         //Text(entry.date, style: .time)         VStack{             Image("check")             Text("# \(Int.random(in: 1..<6))")         }              } } @main struct MyWidget: Widget {     let kind: String = "MyWidget"          var body: some WidgetConfiguration {         IntentConfiguration(kind: kind, intent: ConfigurationIntent.self, provider: Provider()) { entry in             WidgetView(entry: entry)         }         .configurationDisplayName("My Widget")         .description("Leeloo Dallas Multipass.")         .supportedFamilies([.accessoryInline, .accessoryCircular, .systemSmall])     } } struct MyWidget_Previews: PreviewProvider {     static var previews: some View {         WidgetView(entry: WidgetEntry(status: 0, date: Date(), configuration: ConfigurationIntent()))             .previewContext(WidgetPreviewContext(family: .accessoryCircular))     } }
2
0
1.2k
Oct ’22
Is it possible to be notified in background when phone joines/leaves specific Wifi network?
Hello! We have a time reporting app of sorts, where one functionality we have is that users can turn on to check in and out from work via geofencing - i.e. they select a location when they want to start and end a work period. This works great. We have had clients asking for some time to be able to use a wifi network to do the same thing. I.e. check in to work when they join a specific wifi network and checkout when they leave it. So, this is something they will want to use, and will turn on themselves if they want to use it. I have found NWPathMonitor and this thread: https://developer.apple.com/forums/thread/685255 that kind of asks the same thing, but it references specifying why i need it - so i did that above, hoping that someone knows whether i could accomplish this. Thanks in advance!
2
0
822
Jun ’22
Interactive phone call push notification stopped working - only works in xcode
Hey, i have an app with a notification action that enables the user to make a phone call directly from the notification. I made this a good while ago, but we just noticed that it stopped working everywhere - except for when i install it via xcode. To make a long story short, what i do is that in didReceiveNotificationResponse, i get the phone number out from the payload and finally i call [application openURL:[NSURL URLWithString:[@"tel://+" stringByAppendingString:msisdn]] options:@{} completionHandler:nil]; This used to result in that the dialog pops up from the bottom with the phone number and a "call" button, but now it works when installed from xcode, but nothing happens when installed from testflight. I have made debug traces and it gets to the openurl-row with the correct phone number, but nothing seems to happen when i call it. Any idea what has changed? I made this several years ago and haven't touched the code. Pointers appreciated!
0
0
650
Mar ’22
Why can't i run my xcode project in simulator in 12+?
as the title suggests, i cant run my (objective c) project in xcode after upgrading to Xcode 12. It is a Cocoapods project. It works fine when i deploy to my phone, but in the simulator I get three different errors for some reason. It complains about "missing module map" for a separate project i include: module map file '...(path)/Build/Products/Debug-iphonesimulator/MyLibraryProject/MyLibraryProject.imagemap' not found 2. It complains about a precompiled header: <unknown>:0: error: failed to emit precompiled header '(path)/Build/Intermediates.noindex/PrecompiledHeaders/myProject-Bridging-Header-swift2UGSYUUFRK85M-clang18QKMU0TXX4JD.pch' for bridging header '(path)/iphone/myProject/myProject-Bridging-Header.h' 3. Finally it complains about Not finding a bundle for a library that i use: error: Resource "(path)/Products/Debug-iphonesimulator/FCAlertView/FCAlertView.bundle" not found. Run 'pod install' to update the copy resources script. Again, i can build and deploy to my phone, and submit to TestFlight/Appstore, but if i pick an emulator it's crash and burn. I am not very knowledgeable about xcode inner workings, so if anyone has any pointers, i'd be *most* grateful.
0
0
2.0k
Jan ’21
Need tips on adding AutoLayout UIView programmatically with Safe Area
I have a UIView that i create with a XIB. I then want to add it on top of a parent, take up the whole screen but use the safe area i have set up constraints for in the xib. I can add the view fine, but when i do, the safe area is ignored, and the view goes all the way to the top and bottom. The code i use (objective-c still sorry): (UIView *parent) MyViewController *newViewController = [[MyViewController alloc] initWithNibName:MY_VIEW_NIB_NAME bundle:nil]; [view setFrame:CGRectMake(0, 0, parent.bounds.size.width, parent.bounds.size.height)]; [parent addSubview:self.view]; In the Xib, i have the top and bottom constrained to SafeArea.top and bottom. It looks fine in the layout there. Any tips are appreciated.
1
0
855
Jan ’21
How to know if i have asked about always after in-use?
The Core Location talk on WWDC emphasized that it's good to ask for in-use first. It also said that if i have been granted in-use, i can ask for always and get a prompt in the app again. This is good, but i would like to be able to inform our users as clearly as possible, i.e. if no prompt can be shown, i'd like to direct them to settings whenever they try to turn on a feature that requires "always". However, it's seems that there is no way to check whether the "always" question has been asked before, since there is only "NotDetermined". If i have "WhenInUse", i can't know if it's because i asked for always but didn't get it. It would have been great if there was a method like "canAskForAlways" or similar. Is there something i can do or do i have to store some variable in NSUserDefaults so that i know that i have asked for always? This way i can know that i have to show a popup directing the user to settings rather than ask for always but no system dialog pops up. Pointers appreciated.
0
0
648
Aug ’20
Asking for always directly vs. after "when in use"
Hi, we have an app that handles kind of time reporting when at a certain location, and therefor always need precise. The user can click a button to check in/out, but we also have feature that used background location and geofences so that the user can automatically be checked in/out when arriving and leaving a location. When the button is pressed first time we ask for "in use", when the user turns on the feature we ask for "always". The ios13 "provisional" state was therefor pretty detrimental to us since the user might go in an turn it on, expecting it to work, and then leaving work 30 mins later not be automatically checked out. We had to add large banners telling them to go in to settings if they wanted it to work right away... Now from the session, it was mentioned that you changed this in 13.4. However, it was not clear to me exactly when it applied. Our users most often clicks the button first, and then discovers the auto-feature later, but SOME might turn on the feature right away (especially on re-installs). In those cases we will ask for "always" before "in use". In these cases, will it work like before, i.e. we will end up in the "provisional state" like prior to 13.4, just because the user asked for always before in use?
1
0
768
Jun ’20
My app does not find sirkikit intentdefinition classes in xcode 11.4
My app has had support for a couple of siri shortcuts since it came out, haven't touched it in a long time. My project compiles and builds in 11.3.2 but doesn't in 11.4.The errors i get is that the classes that are supposed to be generated from my intentdefinition file, and that i am referencing in my intenthandlers are no longer found.For example, in my intentdefinition file i have a custom intent called "MyStatus".I then have a MyStatusIntentHandler:#import "MyStatusIntent.h"@interface MyStatusIntentHandler&lt;MyStatusIntentHandling&gt; : NSObjectIn 11.4, i get an "MyStatusIntent.h" file not found. In 11.3.1 and earlier it builds fine.I am not super great at project config and structure, so i'm a bit at a loss as to where to start digging. If anyone has any pointers, and what in 11.4 that might be new and giving me problems, I'm all ears.Cheers
10
0
2.5k
Mar ’20