Post

Replies

Boosts

Views

Activity

Reply to Targets vs Library
For option 2... ...you could consider using Swift Package Manager, to make a number of separate self-contained modules. Each App would be it's own Xcode project, and could include whichever Swift Packages it requires. Of course, you could use a single Swift Package, for all the shared code. But I would lean towards using a number of packages, each with a clearly-defined purpose. I find the modular approach cleaner, and easier to maintain.
Mar ’22
Reply to ATTrackingManagerAuthorization Not showing
Tip: To help people understand your code, paste it into a code block (using "Paste and Match Style") -(void)viewDidLoad { UIApplication *applicaiton = [UIApplication sharedApplication]; if (applicaiton.applicationState == UIApplicationStateActive) { if (@available(iOS 14, *)) { ATTrackingManagerAuthorizationStatus status = [ATTrackingManager trackingAuthorizationStatus]; if (status == ATTrackingManagerAuthorizationStatusNotDetermined) { [ATTrackingManager requestTrackingAuthorizationWithCompletionHandler:^(ATTrackingManagerAuthorizationStatus status) { // Tracking authorization completed. Start loading ads here. [[NSOperationQueue mainQueue] addOperationWithBlock:^ { [[GADMobileAds sharedInstance] startWithCompletionHandler:nil]; }]; }]; } } else { [[GADMobileAds sharedInstance] startWithCompletionHandler:nil]; // Fallback on earlier versions } } [super viewDidLoad]; } Did you add the NSUserTrackingUsageDescription key to your info.plist? e.g. <key>NSUserTrackingUsageDescription</key> <string>$(PRODUCT_NAME) needs access to tracking information.</string> Also, it's probably best not to put the tracking request in your viewDidLoad, as the UI hasn't finished laying-out at this point. Might be better to have it in viewDidAppear, or on a button action. Also Also... The system-permission alert will only show when the app’s tracking authorization status is .notDetermined Once the authorization status is set, calling the function will just trigger the completion handler without showing the alert The alert will not be displayed if “Allow Apps to Request to Track” is turned off in the system privacy settings
Mar ’22
Reply to Managing local notifications
the notification is sent each time the user goes to the view controller. The notification is scheduled in viewDidLoad. This suggests that when you leave firstViewController, it is destroyed. So when you re-visit it, it is recreated, and the notification is scheduled again. You don't include the supporting code, showing how firstViewController is instantiated... ... so you could either: Keep firstViewController in memory, so it is not repeatedly created and destroyed or Save a Bool flag somewhere permanent (e.g. in your Data Model, or in the calling ViewController), to record that the notification has been scheduled (and test this flag, before scheduling the notification) Tip: the class "firstViewController" should really be named with a capital first letter: "FirstViewController"
Topic: Programming Languages SubTopic: Swift Tags:
Mar ’22
Reply to PreviewProvider view initializer compiler error
For a more general solution, in your PreviewProvider: create an instance of the type you are using (Root) configure it (if necessary) pass it to RootView struct RootView_Previews: PreviewProvider { static var previews: some View { let root = Root()         /// configure root, if necessary, e.g. root.register = 5         return RootView(rootToView: root) } }
Topic: UI Frameworks SubTopic: SwiftUI Tags:
Mar ’22
Reply to Targets vs Library
For option 2... ...you could consider using Swift Package Manager, to make a number of separate self-contained modules. Each App would be it's own Xcode project, and could include whichever Swift Packages it requires. Of course, you could use a single Swift Package, for all the shared code. But I would lean towards using a number of packages, each with a clearly-defined purpose. I find the modular approach cleaner, and easier to maintain.
Replies
Boosts
Views
Activity
Mar ’22
Reply to Access the phone from Swift without the prompt box
No, this is not possible.
Topic: Programming Languages SubTopic: Swift Tags:
Replies
Boosts
Views
Activity
Mar ’22
Reply to MOUNTING DISK
Also, your Caps Lock key appears to be stuck.
Topic: App & System Services SubTopic: Hardware Tags:
Replies
Boosts
Views
Activity
Mar ’22
Reply to AR Smart Signage - Apple iPhone 12 Pro
Reported as spam.
Replies
Boosts
Views
Activity
Mar ’22
Reply to "The given data was not valid JSON."
Instead of: let decodedResponse = try JSONDecoder().decode(Response.self, from: data) try: let decodedResponse = try JSONDecoder().decode([Response.self], from: data)
Replies
Boosts
Views
Activity
Mar ’22
Reply to ATTrackingManagerAuthorization Not showing
Tip: To help people understand your code, paste it into a code block (using "Paste and Match Style") -(void)viewDidLoad { UIApplication *applicaiton = [UIApplication sharedApplication]; if (applicaiton.applicationState == UIApplicationStateActive) { if (@available(iOS 14, *)) { ATTrackingManagerAuthorizationStatus status = [ATTrackingManager trackingAuthorizationStatus]; if (status == ATTrackingManagerAuthorizationStatusNotDetermined) { [ATTrackingManager requestTrackingAuthorizationWithCompletionHandler:^(ATTrackingManagerAuthorizationStatus status) { // Tracking authorization completed. Start loading ads here. [[NSOperationQueue mainQueue] addOperationWithBlock:^ { [[GADMobileAds sharedInstance] startWithCompletionHandler:nil]; }]; }]; } } else { [[GADMobileAds sharedInstance] startWithCompletionHandler:nil]; // Fallback on earlier versions } } [super viewDidLoad]; } Did you add the NSUserTrackingUsageDescription key to your info.plist? e.g. <key>NSUserTrackingUsageDescription</key> <string>$(PRODUCT_NAME) needs access to tracking information.</string> Also, it's probably best not to put the tracking request in your viewDidLoad, as the UI hasn't finished laying-out at this point. Might be better to have it in viewDidAppear, or on a button action. Also Also... The system-permission alert will only show when the app’s tracking authorization status is .notDetermined Once the authorization status is set, calling the function will just trigger the completion handler without showing the alert The alert will not be displayed if “Allow Apps to Request to Track” is turned off in the system privacy settings
Replies
Boosts
Views
Activity
Mar ’22
Reply to Managing local notifications
the notification is sent each time the user goes to the view controller. The notification is scheduled in viewDidLoad. This suggests that when you leave firstViewController, it is destroyed. So when you re-visit it, it is recreated, and the notification is scheduled again. You don't include the supporting code, showing how firstViewController is instantiated... ... so you could either: Keep firstViewController in memory, so it is not repeatedly created and destroyed or Save a Bool flag somewhere permanent (e.g. in your Data Model, or in the calling ViewController), to record that the notification has been scheduled (and test this flag, before scheduling the notification) Tip: the class "firstViewController" should really be named with a capital first letter: "FirstViewController"
Topic: Programming Languages SubTopic: Swift Tags:
Replies
Boosts
Views
Activity
Mar ’22
Reply to PreviewProvider view initializer compiler error
For a more general solution, in your PreviewProvider: create an instance of the type you are using (Root) configure it (if necessary) pass it to RootView struct RootView_Previews: PreviewProvider { static var previews: some View { let root = Root()         /// configure root, if necessary, e.g. root.register = 5         return RootView(rootToView: root) } }
Topic: UI Frameworks SubTopic: SwiftUI Tags:
Replies
Boosts
Views
Activity
Mar ’22
Reply to Why it is throw an error as "Return from initializer without initializing all stored properties" in SwiftUI?
Your init does not initialize your var "show". Hence the message "Return from initializer without initializing all stored properties".
Topic: UI Frameworks SubTopic: SwiftUI Tags:
Replies
Boosts
Views
Activity
Mar ’22
Reply to Enterprise or Developer Account
If you are thinking of using the App Store, you might want to consider "Unlisted" app distribution. See here: https://developer.apple.com/support/unlisted-app-distribution/
Replies
Boosts
Views
Activity
Mar ’22
Reply to How can we deploy app for BB
You might want to consider App Store "Unlisted" app distribution. See here: https://developer.apple.com/support/unlisted-app-distribution/
Replies
Boosts
Views
Activity
Mar ’22
Reply to Binary operator '==' cannot be applied to operands of type 'Int' and 'Bool'
Like the error message says, you cannot compare an Int and a Bool for equality. Instead of if currentHR == isInTarget { Try if isInTarget { And later, use: } else if isBelowTarget {
Replies
Boosts
Views
Activity
Mar ’22
Reply to Does then new iOS 15.0 interfere on a Objective-C based app ?
Using the iPad mini (6th generation) is a complication here, as it uses a different (smaller) screen size than any previous iPad. Could it be that your code does not take account of this? Do you get the same crash on a "normal" (or larger) iPad?
Topic: UI Frameworks SubTopic: UIKit Tags:
Replies
Boosts
Views
Activity
Mar ’22
Reply to Resetting mac location permission
System Preferences > Security & Privacy > Privacy > Location Services Allow the apps and services below to determine your location. Choose the app, and untick it's permission.
Replies
Boosts
Views
Activity
Mar ’22
Reply to String inerpolation issue using swift 5...
Show your code.
Topic: Programming Languages SubTopic: Swift Tags:
Replies
Boosts
Views
Activity
Feb ’22