#StackBounty: #ios #swift #xcode #environment-variables #setenv Why calling setenv("OS_ACTIVITY_DT_MODE", "disable"…

Bounty: 450

Overly verbose logs produced by 3rd party libraries can be hidden in Swift by setting OS_ACTIVITY_MODE environmnet variable to disable in your run scheme – as shown on the image below.

That silences all NSLog output from your app. I want to disable it only for certain calls. I tried to set the environment variable like this:

setenv("OS_ACTIVITY_MODE", "disable", 1)

And like this

putenv(UnsafeMutablePointer<Int8>(mutating: ("OS_ACTIVITY_MODE=disable" as NSString).utf8String))

The environment is changed as verified by calling print(ProcessInfo.processInfo.environment) but there unlike specifying it in XCode run scheme, the logs are not affected.

Why doesn’t it work and how to fix it?

enter image description here


Get this bounty!!!

#StackBounty: #xcode #xcode11 How to create groups using Xcode 11 file template

Bounty: 200

Recently I found out that I can get rid of tons of boilerplate code by creating my own Xcode file templates, but then I thought, that it would be cooler to create group with all files stored inside this group. However, I didn’t find any solution. Only one answer that was close to my question was Creating sub-groups in XCode 4 Templates, but I tried it and doesn’t work

Contents of my TemplateInfo.plist

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
    <key>Kind</key>
    <string>Xcode.IDEFoundation.TextSubstitutionFileTemplateKind</string>
    <key>Description</key>
    <string>An empty Swift file.</string>
    <key>Summary</key>
    <string>An empty Swift file</string>
    <key>SortOrder</key>
    <string>30</string>
    <key>DefaultCompletionName</key>
    <string>File</string>
    <key>Platforms</key>
    <array>
        <string>com.apple.platform.iphoneos</string>
    </array>
    <key>Definitions</key>
    <dict>
        <key>___FILEBASENAME___.swift</key>
        <dict>
            <key>Group</key>
            <string>Group1</string>
            <key>Path</key>
            <string>___FILEBASENAME___.swift</string>
            <key>TargetIndices</key>
            <array/>
        </dict>
    </dict>
    <key>Nodes</key>
    <array>
        <string>___FILEBASENAME___.swift</string>
    </array>
</dict>
</plist>


Get this bounty!!!

#StackBounty: #swift #xcode tableviewdeleterows crashing app even though data was updated

Bounty: 50

I currently have this block of code that should delete a table row.

extension HomeController: SwipeTableViewCellDelegate {
func tableView(_ tableView: UITableView, editActionsForRowAt indexPath: IndexPath, for orientation: SwipeActionsOrientation) -> [SwipeAction]? {
    guard orientation == .right else { return nil }
    print("in delete")
    let deleteAction = SwipeAction(style: .destructive, title: "Delete") { [self] action, indexPath in
        print("currently deleting")
        userHabitData.remove(at: indexPath.section)
        tableView.deleteRows(at: [indexPath], with: .fade)
    }

    // customize the action appearance
    deleteAction.image = UIImage(named: "delete")

    return [deleteAction]
}

I made sure to change my data source before deleting the row with

userHabitData.remove(at: indexPath.section)

However the code still throws this error

Thread 1: "Invalid update: invalid number of rows in section 0. The number of rows contained in an existing section after the update (1) must be equal to the number of rows contained in that section before the update (1), plus or minus the number of rows inserted or deleted from that section (0 inserted, 1 deleted) and plus or minus the number of rows moved into or out of that section (0 moved in, 0 moved out)."

Here is my complete view controller

//
//  ViewController.swift
//  Habit Tracker
//
//  Created by Alan Weng on 11/24/20.
//

import UIKit
import SwipeCellKit

class tableViewCell: SwipeTableViewCell {
    @IBOutlet weak var habitName: UILabel!
    @IBOutlet weak var habitCount: UILabel!
    
    
    var habit: Habit? {
        didSet {
            self.updateUI()
        }
    }
    
    func updateUI() {
        print("being run")
        habitName?.text = habit?.title
        habitCount?.text = habit?.detail
//        progressLabel?.observedProgress = habit?.progress
    }
    
}

class HomeController: UIViewController, UITableViewDataSource, UITableViewDelegate {

    @IBOutlet weak var deno_label: UILabel!
    @IBOutlet weak var tableView: UITableView!
    let impactFeedbackgenerator = UIImpactFeedbackGenerator(style: .heavy)
    @IBOutlet weak var deno_img: UIImageView!
    var UserHabitDict: [String:String] = [:]
    var userHabitData = [HabitDict]()
    var userHabitName: String?
    var userHabitCount: String?
    let cellReuseID = "habitName"
    let cellSpacingHeight: CGFloat = 15
    let customRed = UIColor().customRed()
    let customBlue = UIColor().customBlue()

    override func viewDidLoad() {
        super.viewDidLoad()
        self.tableView.delegate = self
        self.tableView.dataSource = self
    }

    @IBAction func createNewGoal(_ sender: Any) {
        let goalVC = storyboard?.instantiateViewController(withIdentifier: cellReuseID) as! CreateGoalController
        impactFeedbackgenerator.prepare()
        impactFeedbackgenerator.impactOccurred()
        goalVC.habitDelegate = self
        present(goalVC, animated: true, completion: nil)
    }
    
    // Think of how ios settings have different sections w diff spacings
    func numberOfSections(in tableView: UITableView) -> Int {
        return UserHabitDict.count
    }
    
    // Adjusts cell spacing between habits
    func tableView(_ tableView: UITableView, heightForHeaderInSection section: Int) -> CGFloat {
        return cellSpacingHeight
    }
    
    // Adjust row height
    func tableView(_ tableView: UITableView, heightForRowAt indexPath: IndexPath) -> CGFloat {
        return 75
    }
    
    // Allows the table to keep expanding based on how many habits are in the array
    func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
        return 1
    }
    
    // Make the background color show through
    func tableView(_ tableView: UITableView, viewForHeaderInSection section: Int) -> UIView? {
        let headerView = UIView()
        headerView.backgroundColor = UIColor.clear
        return headerView
    }
    
    func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
        if habitIsEmpty() {
            deno_img.alpha = 0.0
            deno_label.alpha = 0.0
        }
        print("making habit")
        let cell = tableView.dequeueReusableCell(withIdentifier: cellReuseID) as! tableViewCell
        let dictKey = userHabitData[indexPath.section].getName()
        let dictValue = userHabitData[indexPath.section].getCount()
        cell.delegate = self
        cell.backgroundColor = customBlue
        cell.layer.cornerRadius = 10
        cell.habit = Habit(title: dictKey, detail: dictValue)
        print(userHabitData)
        
        return cell
    }
    
    func tableView(_ tableView: UITableView, editActionsOptionsForRowAt indexPath: IndexPath, for orientation: SwipeActionsOrientation) -> SwipeOptions {
        var options = SwipeOptions()
        options.expansionStyle = .destructive
        options.transitionStyle = .border
        return options
    }
    
    func tableView(_ tableView: UITableView, didSelectRowAt indexPath: IndexPath) {
        // note that indexPath.section is used rather than indexPath.row
//        print("You tapped cell number (indexPath.section).")
//        let cell = tableView.dequeueReusableCell(withIdentifier: cellReuseID) as! tableViewCell
//      cell.habit?.updateDetail()
//      tableView.reloadData()
//        let dictKey = userHabitData[indexPath.section].getName()
//        var dictValue = userHabitData[indexPath.section].getCount()
//        print("over here")
//        dictValue = String(Int(dictValue)! - 1)
//        print(dictValue)
//        cell.habit = Habit(title: dictKey, detail: dictValue)
//        tableView.reloadData()
        
    }
    
    func allowMultipleLines(tableViewCell: UITableViewCell) {
        tableViewCell.textLabel?.lineBreakMode = .byWordWrapping
    }
    
    func habitIsEmpty() -> Bool {
        if userHabitData.isEmpty {
            return false
        } else {
            return true
        }
    }
    
}

extension HomeController: CreateGoalDelegate {
    func didTapSave(name: String, count: String) {
        userHabitName = name
        userHabitCount = count
        UserHabitDict[name] = count
        userHabitData.append(HabitDict(habitName: name, habitCount: count))
//      tableView.insertRows(at: [IndexPath(row: userHabitData.count, section: 0)], with: .automatic)
        tableView.reloadData()
        print("in reload data")
    }
}

extension UIColor {
    func customRed() -> UIColor {
        return UIColor(red: 0.607, green: 0.160, blue: 0.282, alpha: 1.00)
    }
    func customBlue() -> UIColor {
        return UIColor(red: 0.509, green: 0.701, blue: 0.964, alpha: 1.00)
    }
}

struct HabitDict {
    let habitName: String
    let habitCount: String
    
    func getName() -> String {
        return habitName
    }
    
    func getCount() -> String {
        return habitCount
    }
}

extension HomeController: SwipeTableViewCellDelegate {
    func tableView(_ tableView: UITableView, editActionsForRowAt indexPath: IndexPath, for orientation: SwipeActionsOrientation) -> [SwipeAction]? {
        guard orientation == .right else { return nil }
        print("in delete")
        let deleteAction = SwipeAction(style: .destructive, title: "Delete") { [self] action, indexPath in
            print("currently deleting")
            userHabitData.remove(at: indexPath.section)
            tableView.deleteRows(at: [indexPath], with: .fade)
        }

        // customize the action appearance
        deleteAction.image = UIImage(named: "delete")

        return [deleteAction]
    }
}

any help would be greatly appreciated!!


Get this bounty!!!

#StackBounty: #swift #xcode #xcode12 Xcode: "<unknown>:0: error: cannot load module 'main' as 'Swift'" …

Bounty: 50

Just started using Swift on Xcode.

For some reason, anytime I want to compile, it shows the error: <unknown>:0: error: cannot load module 'main' as 'Swift'

The only way I could find to fix it is to either clean build folder or delete build folder myself, then compile.

The code I have is just changing from:

print("Hello, world!")

to

print("Hello, world")

Am I doing something totally wrong?

Xcode version: 12.1 (12A7403) with Xcode 12.1 Toolchain


Get this bounty!!!

#StackBounty: #xcode #flutter Xcode 11 apple distribution accepted but impossible to build with flutter

Bounty: 500

I renew my 1 year apple development and renew my certificate

> Xcode 11 supports the new Apple Development and Apple Distribution certificate types. These certificates support building, running, and
> distributing apps on any Apple platform. Preexisting iOS and macOS
> development and distribution certificates continue to work, however,
> new certificates you create in Xcode 11 use the new types. Previous
> versions of Xcode don’t support these certificates. (45527608)

Due to this note for Xcode11, I test to create an Apple distribution instead of iOS distribution like before

So, I create this and select the good provisioning profil in Xcode.

At this step, all is good.

but now when I try to run app

I have

No Provisioning Profile was found for your project's Bundle Identifier or your 
device. You can create a new Provisioning Profile for your project in Xcode for 
your team by:
  1- Open the Flutter project's Xcode target with
       open ios/Runner.xcworkspace
  2- Select the 'Runner' project in the navigator then the 'Runner' target
     in the project settings
  3- Make sure a 'Development Team' is selected. 
     - For Xcode 10, look under General > Signing > Team.
     - For Xcode 11 and newer, look under Signing & Capabilities > Team.
     You may need to:
         - Log in with your Apple ID in Xcode first
         - Ensure you have a valid unique Bundle ID
         - Register your device with your Apple Developer Account
         - Let Xcode automatically provision a profile for your app
  4- Build or run your project again

It's also possible that a previously installed app with the same Bundle 
Identifier was signed with a different certificate.

But my provisioning profil is well accepted in Xcode in signing & capabilities, team is well selected, I’m well connected with my Apple ID

when it’s write :

"It's also possible that a previously installed app with the same Bundle 
Identifier was signed with a different certificate."

I think it’s the case, because I renew my 1 year account, and renew my certificate. I don’t understand what is the problem

I well selected my physical device
I try flutter clean, xcode build clean

If I use automatically manage signing, Xcode select a iOS developpement profile type, so I can build and run my app, but If I select manually my Apple distribution it doesn’t work


Get this bounty!!!

#StackBounty: #ios #xcode #macos #flutter #google-cloud-firestore 'FirebaseCore/FirebaseCore.h' file not found while building f…

Bounty: 50

I am able to run the app in Debug mode in XCODE and simulator without any errors. But when I build for Release Mode the build fails with below 2 errors:

  1. ‘FirebaseCore/FirebaseCore.h’ file not found
  2. Could not build Objective-C module ‘Firebase’

I have been trying different solutions available on Stackoverflow and gitHub over last 10 days but know seems to be working, below are the details.

FLUTTER DOCTOR :

Doctor summary (to see all details, run flutter doctor -v):
[✓] Flutter (Channel stable, v1.17.3, on Mac OS X 10.15.3 19D76, locale en-IN)

[✓] Android toolchain - develop for Android devices (Android SDK version 30.0.0)
[✓] Xcode - develop for iOS and macOS (Xcode 11.5)
[✓] Android Studio (version 4.0)
[✓] Connected device (2 available)

• No issues found!

POD FILE :

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

# CocoaPods analytics sends network stats synchronously affecting flutter build latency.
ENV['COCOAPODS_DISABLE_STATS'] = 'true'

project 'Runner', {
  'Debug' => :debug,
  'Profile' => :release,
  'Release' => :release,
}

def parse_KV_file(file, separator='=')
  file_abs_path = File.expand_path(file)
  if !File.exists? file_abs_path
    return [];
  end
  generated_key_values = {}
  skip_line_start_symbols = ["#", "/"]
  File.foreach(file_abs_path) do |line|
    next if skip_line_start_symbols.any? { |symbol| line =~ /^s*#{symbol}/ }
    plugin = line.split(pattern=separator)
    if plugin.length == 2
      podname = plugin[0].strip()
      path = plugin[1].strip()
      podpath = File.expand_path("#{path}", file_abs_path)
      generated_key_values[podname] = podpath
    else
      puts "Invalid plugin specification: #{line}"
    end
  end
  generated_key_values
end

target 'Runner' do
  use_frameworks!
  use_modular_headers!

  # Flutter Pod

  copied_flutter_dir = File.join(__dir__, 'Flutter')
  copied_framework_path = File.join(copied_flutter_dir, 'Flutter.framework')
  copied_podspec_path = File.join(copied_flutter_dir, 'Flutter.podspec')
  unless File.exist?(copied_framework_path) && File.exist?(copied_podspec_path)
    # Copy Flutter.framework and Flutter.podspec to Flutter/ to have something to link against if the xcode backend script has not run yet.
    # That script will copy the correct debug/profile/release version of the framework based on the currently selected Xcode configuration.
    # CocoaPods will not embed the framework on pod install (before any build phases can generate) if the dylib does not exist.

    generated_xcode_build_settings_path = File.join(copied_flutter_dir, 'Generated.xcconfig')
    unless File.exist?(generated_xcode_build_settings_path)
      raise "Generated.xcconfig must exist. If you're running pod install manually, make sure flutter pub get is executed first"
    end
    generated_xcode_build_settings = parse_KV_file(generated_xcode_build_settings_path)
    cached_framework_dir = generated_xcode_build_settings['FLUTTER_FRAMEWORK_DIR'];

    unless File.exist?(copied_framework_path)
      FileUtils.cp_r(File.join(cached_framework_dir, 'Flutter.framework'), copied_flutter_dir)
    end
    unless File.exist?(copied_podspec_path)
      FileUtils.cp(File.join(cached_framework_dir, 'Flutter.podspec'), copied_flutter_dir)
    end
  end

  # Keep pod path relative so it can be checked into Podfile.lock.
  pod 'Flutter', :path => 'Flutter'

  # Plugin Pods

  # Prepare symlinks folder. We use symlinks to avoid having Podfile.lock
  # referring to absolute paths on developers' machines.
  system('rm -rf .symlinks')
  system('mkdir -p .symlinks/plugins')
  plugin_pods = parse_KV_file('../.flutter-plugins')
  plugin_pods.each do |name, path|
    symlink = File.join('.symlinks', 'plugins', name)
    File.symlink(path, symlink)
    pod name, :path => File.join(symlink, 'ios')
  end
end

post_install do |installer|
  installer.pods_project.targets.each do |target|
    target.build_configurations.each do |config|
      config.build_settings['ENABLE_BITCODE'] = 'NO'
    end
  end
end

AppDelegate.swift (file) :

import UIKit
import Flutter
import Firebase

@UIApplicationMain
@objc class AppDelegate: FlutterAppDelegate {

    override func application(
    _ application: UIApplication,
    didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?
  ) -> Bool {
  FirebaseApp.configure()
    GeneratedPluginRegistrant.register(with: self)
    return super.application(application, didFinishLaunchingWithOptions: launchOptions)
  }
}

Firebase.h file (Path: Pods>Pods>Firebase>CoreOnly>Firebase.h) :

// Copyright 2019 Google
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
//      http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.

#import <FirebaseCore/FirebaseCore.h>

#if !defined(__has_include)
  #error "Firebase.h won't import anything if your compiler doesn't support __has_include. Please 
          import the headers individually."
#else
  #if __has_include(<FirebaseAnalytics/FirebaseAnalytics.h>)
    #import <FirebaseAnalytics/FirebaseAnalytics.h>
  #endif

  #if __has_include(<FirebaseAuth/FirebaseAuth.h>)
    #import <FirebaseAuth/FirebaseAuth.h>
  #endif

  #if __has_include(<FirebaseCrashlytics/FirebaseCrashlytics.h>)
    #import <FirebaseCrashlytics/FirebaseCrashlytics.h>
  #endif

  #if __has_include(<FirebaseDatabase/FirebaseDatabase.h>)
    #import <FirebaseDatabase/FirebaseDatabase.h>
  #endif

  #if __has_include(<FirebaseDynamicLinks/FirebaseDynamicLinks.h>)
    #import <FirebaseDynamicLinks/FirebaseDynamicLinks.h>
    #if !__has_include(<FirebaseAnalytics/FirebaseAnalytics.h>)
      #ifndef FIREBASE_ANALYTICS_SUPPRESS_WARNING
        #warning "FirebaseAnalytics.framework is not included in your target. Please add 
`Firebase/Analytics` to your Podfile or add FirebaseAnalytics.framework to your project to ensure 
Firebase Dynamic Links works as intended."
      #endif // #ifndef FIREBASE_ANALYTICS_SUPPRESS_WARNING
    #endif
  #endif

  #if __has_include(<FirebaseFirestore/FirebaseFirestore.h>)
    #import <FirebaseFirestore/FirebaseFirestore.h>
  #endif

  #if __has_include(<FirebaseFunctions/FirebaseFunctions.h>)
    #import <FirebaseFunctions/FirebaseFunctions.h>
  #endif

  #if __has_include(<FirebaseInAppMessaging/FirebaseInAppMessaging.h>)
    #import <FirebaseInAppMessaging/FirebaseInAppMessaging.h>
    #if !__has_include(<FirebaseAnalytics/FirebaseAnalytics.h>)
      #ifndef FIREBASE_ANALYTICS_SUPPRESS_WARNING
        #warning "FirebaseAnalytics.framework is not included in your target. Please add 
`Firebase/Analytics` to your Podfile or add FirebaseAnalytics.framework to your project to ensure 
Firebase In App Messaging works as intended."
      #endif // #ifndef FIREBASE_ANALYTICS_SUPPRESS_WARNING
    #endif
  #endif

  #if __has_include(<FirebaseInstanceID/FirebaseInstanceID.h>)
    #import <FirebaseInstanceID/FirebaseInstanceID.h>
  #endif

  #if __has_include(<FirebaseMessaging/FirebaseMessaging.h>)
    #import <FirebaseMessaging/FirebaseMessaging.h>
      #if !__has_include(<FirebaseAnalytics/FirebaseAnalytics.h>)
      #ifndef FIREBASE_ANALYTICS_SUPPRESS_WARNING
        #warning "FirebaseAnalytics.framework is not included in your target. Please add 
`Firebase/Analytics` to your Podfile or add FirebaseAnalytics.framework to your project to ensure 
Firebase Messaging works as intended."
      #endif // #ifndef FIREBASE_ANALYTICS_SUPPRESS_WARNING
    #endif
#endif

  #if __has_include(<FirebaseMLCommon/FirebaseMLCommon.h>)
    #import <FirebaseMLCommon/FirebaseMLCommon.h>
  #endif

  #if __has_include(<FirebaseMLModelInterpreter/FirebaseMLModelInterpreter.h>)
    #import <FirebaseMLModelInterpreter/FirebaseMLModelInterpreter.h>
  #endif

  #if __has_include(<FirebaseMLNLLanguageID/FirebaseMLNLLanguageID.h>)
    #import <FirebaseMLNLLanguageID/FirebaseMLNLLanguageID.h>
  #endif

  #if __has_include(<FirebaseMLNLSmartReply/FirebaseMLNLSmartReply.h>)
    #import <FirebaseMLNLSmartReply/FirebaseMLNLSmartReply.h>
  #endif

  #if __has_include(<FirebaseMLNLTranslate/FirebaseMLNLTranslate.h>)
    #import <FirebaseMLNLTranslate/FirebaseMLNLTranslate.h>
  #endif

  #if __has_include(<FirebaseMLNaturalLanguage/FirebaseMLNaturalLanguage.h>)
    #import <FirebaseMLNaturalLanguage/FirebaseMLNaturalLanguage.h>
  #endif

  #if __has_include(<FirebaseMLVision/FirebaseMLVision.h>)
    #import <FirebaseMLVision/FirebaseMLVision.h>
  #endif

  #if __has_include(<FirebaseMLVisionAutoML/FirebaseMLVisionAutoML.h>)
    #import <FirebaseMLVisionAutoML/FirebaseMLVisionAutoML.h>
  #endif

  #if __has_include(<FirebaseMLVisionBarcodeModel/FirebaseMLVisionBarcodeModel.h>)
    #import <FirebaseMLVisionBarcodeModel/FirebaseMLVisionBarcodeModel.h>
  #endif

  #if __has_include(<FirebaseMLVisionFaceModel/FirebaseMLVisionFaceModel.h>)
    #import <FirebaseMLVisionFaceModel/FirebaseMLVisionFaceModel.h>
  #endif

  #if __has_include(<FirebaseMLVisionLabelModel/FirebaseMLVisionLabelModel.h>)
    #import <FirebaseMLVisionLabelModel/FirebaseMLVisionLabelModel.h>
  #endif

  #if __has_include(<FirebaseMLVisionObjectDetection/FirebaseMLVisionObjectDetection.h>)
    #import <FirebaseMLVisionObjectDetection/FirebaseMLVisionObjectDetection.h>
  #endif

  #if __has_include(<FirebaseMLVisionTextModel/FirebaseMLVisionTextModel.h>)
    #import <FirebaseMLVisionTextModel/FirebaseMLVisionTextModel.h>
  #endif

  #if __has_include(<FirebasePerformance/FirebasePerformance.h>)
    #import <FirebasePerformance/FirebasePerformance.h>
    #if !__has_include(<FirebaseAnalytics/FirebaseAnalytics.h>)
      #ifndef FIREBASE_ANALYTICS_SUPPRESS_WARNING
        #warning "FirebaseAnalytics.framework is not included in your target. Please add 
`Firebase/Analytics` to your Podfile or add FirebaseAnalytics.framework to your project to ensure 
Firebase Performance works as intended."
      #endif // #ifndef FIREBASE_ANALYTICS_SUPPRESS_WARNING
    #endif
  #endif

  #if __has_include(<FirebaseRemoteConfig/FirebaseRemoteConfig.h>)
    #import <FirebaseRemoteConfig/FirebaseRemoteConfig.h>
    #if !__has_include(<FirebaseAnalytics/FirebaseAnalytics.h>)
      #ifndef FIREBASE_ANALYTICS_SUPPRESS_WARNING
        #warning "FirebaseAnalytics.framework is not included in your target. Please add 
`Firebase/Analytics` to your Podfile or add FirebaseAnalytics.framework to your project to ensure 
Firebase Remote Config works as intended."
      #endif // #ifndef FIREBASE_ANALYTICS_SUPPRESS_WARNING
    #endif
  #endif

  #if __has_include(<FirebaseStorage/FirebaseStorage.h>)
    #import <FirebaseStorage/FirebaseStorage.h>
  #endif

  #if __has_include(<GoogleMobileAds/GoogleMobileAds.h>)
    #import <GoogleMobileAds/GoogleMobileAds.h>
  #endif

  #if __has_include(<Fabric/Fabric.h>)
    #import <Fabric/Fabric.h>
  #endif

  #if __has_include(<Crashlytics/Crashlytics.h>)
    #import <Crashlytics/Crashlytics.h>
  #endif

#endif  // defined(__has_include)

Firebase.h error

Firebase.h error

Could not build Objective-C module ‘Firebase’

Could not build Objective-C module 'Firebase'


Get this bounty!!!

#StackBounty: #ios #swift #xcode #audio #audio-recording How to record audio with a certain threshold filter in swift

Bounty: 50

enter image description here

I need to add this functionality in one of my app in swift, I want the user to adjust the threshold and so it’ll be only recorded when it crosses the limit set by the user and stop automatically or in a given time when the user stops.

It would be great if you can share your expertise in how to collect all the data in one file like when a user will pause and continue it’ll keep all the audio in one file.

I actually have no idea about this and will truly appreciate any kind of feedback.

Thanks.


Get this bounty!!!

#StackBounty: #ios #swift #xcode #segue Manual (automatic) Segue not working – table view cell

Bounty: 400

I’m new to Xcode and I’m following the tutorial here which goes through how to add a manual segue.

https://github.com/AdditionAddict/learnXcode

Problem: When clicking on a table cell in the simulator the manual segue is not triggered.

What I’ve tried: I’ve added a manual (automatic) segue, an identifier, and whilst the tutorial says as this point a selection of a cell with result in going from the table view cell to the meal detail scene, I’ve continued to the code part and my breakpoint in prepare still does not trigger.

    // MARK: - Navigation

    override func prepare(for segue: UIStoryboardSegue, sender: Any?) {
        super.prepare(for: segue, sender: sender)
        
        switch(segue.identifier ?? "") {
            
        case "AddItem":
            os_log("Adding a new meal", log: OSLog.default, type: .debug)
            
        case "ShowDetail":
            // set the meal for the `MealViewController` as the meal selected in the `MealTableViewController`
            os_log("Show detail of a meal", log: OSLog.default, type: .debug)
            
            guard let mealDetailViewController = segue.destination as? MealViewController else {
                fatalError("Unexpected destination, (segue.destination)")
            }
            guard let selectedMealCell = sender as? MealTableViewCell else {
                fatalError("Unexpected sender, (String(describing: sender))")
            }
            guard let indexPath = tableView.indexPath(for: selectedMealCell) else {
                fatalError("The selected cell is not being displayed by the table")
            }
            
            let selectedMeal = meals[indexPath.row]
            mealDetailViewController.meal = selectedMeal
            
        default:
            fatalError("Unexpected Segue Identifier")
        }
    }

Checks made:
If, for the purposes of debugging only, I put the following in my MealTableViewController.swift with a breakpoint nothing happens when I click a table cell:

    override func shouldPerformSegue(withIdentifier identifier: String, sender: Any?) -> Bool {
        return true
    }

This makes me think the table cells aren’t registering a ‘selection’.

Table View Selection property is Single Selection.

The custom MealTableViewCell has User Interaction Enabled checked.

Clicking the MealTableViewCell in the outline pane and selecting the Connections inspector in the utilities pane also shows the segue:

Connections Inspector showing segue

Final bits: Is it still possible to add a manual (automatic) segue?
Tutorial is in archive and I’ve managed to follow most of it with small changes.
Using Xcode 11.6

main.storyboard and Identity Inspector

Edit(s) / answers to comment questions:

  1. added (automatic) to manual. I mean the method the tutorial uses from table cell to meal detail.
  2. There isn’t anything in front of the table (that I’m aware of) such as a tap gesture recogniser
  3. The Plus segue works and triggers the prepare unlike clicking a table cell


Get this bounty!!!

#StackBounty: #xcode #macos #nstableview #appkit NSTableView selected row flickering while scrolling with arrow keys

Bounty: 200

I have a view based NSTableView and can’t figure out how to work around a visual glitch where the currently selected row flickers while scrolling up or down with the arrow keys.

The selected row should appear ‘glued’ to either the top or bottom of the view, depending on scroll direction. The Finder shows this correct behavior in list view but a regular table view seems to not behave this way out of the box. I’m confused as to why that is and see no obvious way to circumvent it. Can anybody point me to possible causes / solutions?

Edit No. 1

A cell based NSTableView behaves in the desired way by default, so this is presumably a bug specific to the view based implementation. I don’t want to use a cell based table for unrelated reasons though.

Edit No. 2

I’ve tried making the table view’s parent view layer backed, as well as intercepting the up / down arrow keystrokes to do my own scrolling, but so far I haven’t been able to eliminate the flickering.

Edit No. 3

I’ve created a small sample project that reproduces the issue.


Get this bounty!!!

#StackBounty: #c++ #ios #xcode #static-libraries Undefined symbols for architecture arm64 after linking a static library in iOS app

Bounty: 50

I am creating a sample static library to be used in my iOS app, however, when calling the static library’s methods, I ran into a linker error:

Undefined symbols for architecture arm64:
"_doMath", referenced from:
  _doMathInterface in libTestMain.a(Test.o)
 (maybe you meant: _doMathInterface)
ld: symbol(s) not found for architecture arm64
clang: error: linker command failed with exit code 1 (use -v to see invocation)

Here is the static library’s structure:

I have a header file Test.h:

#import <Foundation/Foundation.h>

@interface Test : NSObject

int doMathInterface(int a, int b);

@end

and its implementation Test.m :

#import "Test.h"
#include "PaymentAPI.h"

@implementation Test

int doMathInterface(int a, int b){
    return doMath(a, b);
}

@end

and in PaymentAPI.h:

#ifndef PaymentAPI_h
#define PaymentAPI_h

int doMath(int a, int b);

#endif /* PaymentAPI_h */

Finally in PaymentAPI.cpp:

#include <stdio.h>
#include "PaymentAPI.h"

int doMath(int a, int b){
    return a + b;
}

As you can see it’s a very simple static library but I couldn’t figure out why this linker error is happening, I have added the static library in the "Link Binaries with Libraries" in Build Phases in the app.

Here is a screenshot of the app‘s files:

enter image description here

and search paths configuration in build settings is also correct, I believe:

enter image description here

Here is a screenshot of some build settings for the static library project

Build Phases:
enter image description here

Architecture:
enter image description here

Thanks a lot.


Get this bounty!!!