Monday, December 7, 2020

Xcode 12 - Could not find module for target 'arm64-apple-ios-simulator'; found: x86_64-apple-ios-simulator, x86_64


1. Select Target , and choose Build Settings tab, At the bottom, you will fond 'User-Defined' section, add " x86_64 i386" values to the VALID_ARCHS















2. Build Settings tab, Search 'Architecture' to see the 'Architecture' section, set 'Yes' for the key 'Build Active Architecture Only'













Thanks for reading.

Thursday, July 16, 2020

Mac - No disk space issue - delete caches and unwanted files.



1. Delete unwanted applications from /Applications (to go to this folder type "/Applications" in Finder -> Go -> Go To Folder

2. You may deleted unused application earlier or now, So check the folder ~/Library/Application Support  for any related data exist for the deleted applications. You can remove delete that too. (If you are not sure when deleting, then take a back up to any external disk)

3. Go to  ~/Library/Caches and delete all files inside the each folders. Don't delete the folders inside the Caches. This case also, you can take backup.

If you are a iOS developer,

4. Delete unwanted simulators from the path. ~/Library/Developer/Xcode/iOS DeviceSupport/

5. Delete Archived files from ~/Library/Developer/Xcode/Archives  . This will delete all archived apps which we seeing from Xcode -> Window -> Organizer

6. Go to Xcode -> Preferences - > Locations tab  . Delete all 'Derived data' (~/Library/Developer/Xcode/Archives) and 'Archives' (~/Library/Developer/Xcode/DerivedData). Tap the -> arrow key to navigate to the folders.


Monday, April 27, 2020

iOS - CICD Automate Test Flight submission using GitHb Actions



From 2019, GitHub introduced GotHub actions.

So without any third party we are able to automate our deployment process for our private and public git repositories.

We can create workflow (a yml file) to trigger when push to specific branch etc...

This https://engineering.talkdesk.com/test-and-deploy-an-ios-app-with-github-actions-44de9a7dcef6 is a very good tutorial for do this process.

By adding .yml workflow file, we can automate the process of check out source, make build, signing process and submit ipa to test flight.

When you go through the above link, you may face some issues

To see our actions working or not, you will get mail form GitHub if any failure, or you can look at the  repositories' 'Actions' (4th) tab. first is 'Code' tab.

Don't forget to set read/write permission for the script file (.sh files)

---Update 1

If you need to update your build number automatically, then use

Thursday, January 23, 2020

Swift enum - make Encodable

Suppose you have struct like below to encode as { status: "",  macName: "" }

struct Request: Encodable {

      var status: MacStatus
      var macName: String
}

enum MacStatus {

    case running
    case notRunning
}

Now we want to make the enum  MacStatus as encodable. So we can use singleValueContainer

extension MacStatus: Encodable {

    var josnKey: String {
        switch self {
        case . running:
            return "Running"
        case . notRunning:
            return "Not Running"
   }

    public func encode(to encoder: Encoder) throws {
        var container = encoder.singleValueContainer()
        try container.encode(josnKey)
    }
}

Another way is below:

enum MacStatus: String, Encodable {

    case running
    case notRunning

   var rawValue {
       switch self {
           case . running:
                return "Running"
           case . notRunning:
                return "Not Running"
       }
   }
}