Storyboard project all programmatically

  1. New Project Storyboard
  2. TabBar07> Info > DELETE Main storyboard file base name row
  3. TabBar07> Info > Application Scene Manifest > Scene Configuration > Application Session Role > ... > DELETE Storyboard Name
  4. Delete the Main.storyboard file > “Move to Trash” (gray)
  5. Clean build folder

Get Object Type

Add operations to main thread

Most commone an concise way:

DispatchQueue.main.async {
    // UI updates go here
}

Push notifications

Simulators

Simulators are mounted on my computer here: /Library/Developer/CoreSimulator/Images/

LocationManger

Method: startUpdatingLocation()

Method: startMonitoringSignificantLocationChanges()

Method: requestLocation()

CocoaPods and Sentry

These notes may be missing some earlier steps because I already had CocoaPods and Sentry in another project. But this is what I am doing 2024-08-22.

Install Sentry via brew

navigate to Project folder

In this case I was in the root of WhatSticks13iOS

# Uncomment the next line to define a global platform for your project
# platform :ios, '9.0'

target 'WhatSticks13iOS' do
  # Comment the next line if you don't want to use dynamic frameworks
  use_frameworks!

  # Pods for WhatSticks13iOS

end

Modify Podfile

This is what I will try now to match with the minimum deployment and the project name for WhatSticks13iOS

platform :ios, '17.0'
use_frameworks!

target 'WhatSticks13iOS' do
  pod 'Sentry'
end

Install CocoaPods

From the terminal in the project root do: pod install

Get DSN from Client Keys and place in Project

Settings > Team > Project > Client Keys

implementation

import UIKit
import Sentry

@main
class AppDelegate: UIResponder, UIApplicationDelegate {
    func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool {
        // Override point for customization after application launch.
        print("- in AppDelegate -")
        SentrySDK.start { options in
            options.dsn = Config.sentryDSN
            options.debug = false // Enabled debug when first installing is always helpful
        }
        return true
    }
    // more code/methods
}

adding Error Symbols

  1. Sentry.io website logged in as you.

  2. Left panel under your name “Settings” > "Team" >

  3. Click on “Custom Integrations” link next panel just inside form Settings

  4. Click “Create New Integration”

  5. Choose Type: “Internal Integration”

  6. Settings:

    1. webhooks: I left empty
    2. Permissions Project: Read & Write
    3. Permissions Issue & Event: Read & Write
    4. Add "New Token" for use in step #7
  7. Download Sentry CLI terminal command: curl -sL https://sentry.io/get-cli/ | SENTRY_CLI_VERSION="2.20.5" sh

  8. Locate the .xacheive files

    1. You will need the path. Mine was: "/Users/nick/Library/Developer/Xcode/Archives/2023-09-02/TuRincon 02-09-2023 09.11.xcarchive"
    2. To find it go to your Xcode project > Window > Organizer > Select and Archives > then right click to “Show in Finder”
  9. Link in terminal:

sentry-cli debug-files upload --auth-token [insert_token_from_custom_integrations_here] \
  --include-sources \
  --org nick-rodriguez-911def83e \
  --project apple-ios \
  "[enter_path_and_file_name_of_.xcarchive_file]"

Delegate Method Pattern

Allow a child UIViewController to call a method of its parent UIViewController. Child UIViews can have have delegates to parent UIViewControllers. The general steps are:

  1. Define a protocol (the delegate) that declares the method(s) to be called.
  2. Have the parent view controller conform to this protocol.
  3. Assign the parent view controller as the delegate of the child view controller.
  4. Use the delegate in the child view controller to call the method in the parent.

ChildViewController.swift

import UIKit

class ChildViewController: UIViewController {
    // Define the delegate property
    weak var delegate: ChildViewControllerDelegate?
    override func viewDidLoad() {}
}

protocol ChildViewControllerDelegate: AnyObject {
    func didTapButtonInChildViewController()
}

ParentViewController.swift

import UIKit

class ParentViewController: UIViewController, ChildViewControllerDelegate {
    
    override func viewDidLoad() {
        super.viewDidLoad()
    }

Troubleshooting:

maybe something with cocoapods?

simulator

This problem arised from react native expo app not finding the Xcode iOS simulator

  1. check xcode-select -p
    1. if the path is /Library/Developer/CommandLineTools probably needs to be changed to recognize this as the path by:
    2. change path sudo xcode-select --switch /Applications/Xcode.app/Contents/Developer