LaVOZs

The World’s Largest Online Community for Developers

'; ios - [NSPlaceholderString initWithString:]: nil argument' on iOS13 - LavOzs.Com

Heres my situation i have a UICollectionView nested inside a UITableVIew the table view scrolls vertically and the collection view scrolls horizontally inside the table view.

i have made the tableview as the delegate for the collection view here a code snippet:

i know this code doesnt make sense cause i have removed a lot of stuff from it i just shared it for you guys to see how i set up the tableview and the collectionview in case its helpful

class HomeViewController: UIViewController,UITableViewDelegate,UITableViewDataSource,UICollectionViewDataSource,UICollectionViewDelegate{
    @IBOutlet weak var homeTable: UITableView!
    func languageDidChange(){
        tabBarItem.title = NSLocalizedString("home", comment: "")
        homeTitle.text = NSLocalizedString("browseservice", comment: "")
    }
    @objc func languageDidChangeNotification(notification:NSNotification){
        languageDidChange()
    }
    override func viewDidLoad() {
        super.viewDidLoad()
        NotificationCenter.default.addObserver(self, selector: #selector(languageDidChangeNotification(notification:)), name: NSNotification.Name(rawValue: "LANGUAGE_DID_CHANGE"), object: nil)
        languageDidChange()
        SVProgressHUD.setDefaultMaskType(.custom)
        SVProgressHUD.show(withStatus: "Loading...")
        request.sendRequest("/some/url", headers: [:], method: .get, completion: {serverResponse in
            if(serverResponse != nil){
                //refresh the tableview when fetching data is complete
                DispatchQueue.main.async {
                    self.homeTable.reloadData()
                    SVProgressHUD.dismiss()
                }
            }else{
                SVProgressHUD.dismiss()
                //show network error dialog
            }
        })
        homeTable.delegate = self
        homeTable.dataSource  = self
    }


    let cellSpacingHeight: CGFloat = 0

    func numberOfSections(in tableView:UITableView)->Int{
        //number of categories:vertical
        return 3
    }
    func tableView(_ tableView:UITableView,numberOfRowsInSection section:Int)->Int{
        return 1
    }
    func tableView(_ tableView: UITableView, heightForHeaderInSection section: Int) -> CGFloat {
        return cellSpacingHeight
    }
    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{
        let cell = tableView.dequeueReusableCell(withIdentifier: "CategoryCell") as! CategoryCell

        //set the tabeview as the delegate for the collection view
        cell.collectionView.delegate = self
        cell.collectionView.dataSource = self
        cell.collectionView.reloadData()

        cell.collectionView.tag = indexPath.section

        cell.serviceCategoryName.text = someTitles[indexPath.section]
        return cell
    }

    func collectionView(_ collectionView: UICollectionView, numberOfItemsInSection section: Int) -> Int {
        for i in 0 ..< servicesData.count {
            //this checks is the current tableview cell is equal to the current collection view cell
            //if it is then the current collectionview cell belongs to the current tableview cell
            //which it will then tell it how many elemnts are in the current tableview cell
            if(collectionView.tag == servicesData[i].catId){
                return servicesData[i].count
            }
        }

        return 0
    }
    func collectionView(_ collectionView: UICollectionView, cellForItemAt indexPath: IndexPath) -> UICollectionViewCell {

        let cell = collectionView.dequeueReusableCell(withReuseIdentifier: "serviceCell", for: indexPath) as! ServiceCollectionCell

        cell.serviceName.text = servicesResponse["data"][collectionView.tag]["subcategories"][indexPath.row]["name"].stringValue
        let imageUrl = servicesResponse["data"][collectionView.tag]["subcategories"][indexPath.row]["photo"].stringValue
        cell.serviceImg.loadImageFromUrl(url: imageUrl)

        return cell

    }
    func collectionView(_ collectionView: UICollectionView, didSelectItemAt indexPath: IndexPath) {

        //handle the click
    }

}
class ServiceCollectionCell: UICollectionViewCell {
    //a cell inside the collection view with image and a title
    @IBOutlet weak var serviceImg: UIImageView!
    @IBOutlet weak var serviceName: UILabel!
}
class CategoryCell: UITableViewCell {
    //this is a single tableview cell containg the collection view
    //every tableview cell has a collection view inside it
    @IBOutlet weak var serviceCategoryName: UILabel!
    @IBOutlet weak var collectionView: UICollectionView!
}

now the problem is this code only crashes on iOS 13 i have tried it with other versions and works fine heres the error its giving me:

Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '*** -[NSPlaceholderString initWithString:]: nil argument'

heres the full stacktrace:

Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '*** -[NSPlaceholderString initWithString:]: nil argument'
*** First throw call stack:
(
    0   CoreFoundation                      0x00007fff23c7127e __exceptionPreprocess + 350
    1   libobjc.A.dylib                     0x00007fff513fbb20 objc_exception_throw + 48
    2   Foundation                          0x00007fff2577d523 -[NSPlaceholderString initWithValidatedFormat:validFormatSpecifiers:locale:arguments:error:] + 0
    3   Foundation                          0x00007fff2577606b +[NSString stringWithString:] + 45
    4   UIFoundation                        0x00007fff4754444b __NSNormalizedLanguage + 97
    5   UIFoundation                        0x00007fff475443d3 ____NSNormalizedPreferredLanguage_block_invoke + 49
    6   libdispatch.dylib                   0x0000000105d7ad48 _dispatch_client_callout + 8
    7   libdispatch.dylib                   0x0000000105d7c297 _dispatch_once_callout + 66
    8   UIFoundation                        0x00007fff475440b0 -[NSParagraphArbitrator lineBreakContextBeforeIndex:lineFragmentWidth:range:] + 2859
    9   UIFoundation                        0x00007fff475694c4 -[NSCoreTypesetter _stringDrawingCoreTextEngineWithOriginalString:rect:padding:graphicsContext:forceClipping:attributes:stringDrawingOptions:drawingContext:wantsTextLineFragments:validatedAttributedString:firstNonRenderedCharacterIndex:foundSoftHyphenAtEOL:enginePathUsed:] + 5554
    10  UIFoundation                        0x00007fff47562a67 __NSStringDrawingEngine + 5999
    11  UIFoundation                        0x00007fff475612ce -[NSString(NSExtendedStringDrawing) boundingRectWithSize:options:attributes:context:] + 187
    12  UIKitCore                           0x00007fff484bd306 -[UILabel _textRectForBounds:limitedToNumberOfLines:includingShadow:] + 1456
    13  UIKitCore                           0x00007fff484bcb37 -[UILabel textRectForBounds:limitedToNumberOfLines:] + 50
    14  UIKitCore                           0x00007fff484c2519 -[UILabel _intrinsicSizeWithinSize:] + 384
    15  UIKitCore                           0x00007fff484c2831 -[UILabel intrinsicContentSize] + 245
    16  UIKitCore                           0x00007fff4848dd23 -[UIView(UIConstraintBasedLayout) _generateContentSizeConstraints] + 35
    17  UIKitCore                           0x00007fff4848d9f9 -[UIView(UIConstraintBasedLayout) _updateContentSizeConstraints] + 402
    18  UIKitCore                           0x00007fff484988ed -[UIView(AdditionalLayoutSupport) _updateSystemConstraints] + 112
    19  UIKitCore                           0x00007fff48497464 -[UIView(AdditionalLayoutSupport) _sendUpdateConstraintsIfNecessaryForSecondPass:] + 489
    20  UIKitCore                           0x00007fff48497a38 -[UIView(AdditionalLayoutSupport) _updateConstraintsIfNeededCollectingViews:forSecondPass:] + 1193
    21  UIKitCore                           0x00007fff484978c5 -[UIView(AdditionalLayoutSupport) _updateConstraintsIfNeededCollectingViews:forSecondPass:] + 822
    22  UIKitCore                           0x00007fff484978c5 -[UIView(AdditionalLayoutSupport) _updateConstraintsIfNeededCollectingViews:forSecondPass:] + 822
    23  Foundation                          0x00007fff258d8263 -[NSISEngine withBehaviors:performModifications:] + 84
    24  UIKitCore                           0x00007fff48497c4e -[UIView(AdditionalLayoutSupport) _recursiveUpdateConstraintsIfNeededCollectingViews:forSecondPass:] + 112
    25  UIKitCore                           0x00007fff484978c5 -[UIView(AdditionalLayoutSupport) _updateConstraintsIfNeededCollectingViews:forSecondPass:] + 822
    26  UIKitCore                           0x00007fff484978c5 -[UIView(AdditionalLayoutSupport) _updateConstraintsIfNeededCollectingViews:forSecondPass:] + 822
    27  UIKitCore                           0x00007fff484978c5 -[UIView(AdditionalLayoutSupport) _updateConstraintsIfNeededCollectingViews:forSecondPass:] + 822
    28  Foundation                          0x00007fff258d8263 -[NSISEngine withBehaviors:performModifications:] + 84
    29  UIKitCore                           0x00007fff48497f13 -[UIView(AdditionalLayoutSupport) _updateConstraintsIfNeededWithViewForVariableChangeNotifications:] + 632
    30  UIKitCore                           0x00007fff48498c51 -[UIView(AdditionalLayoutSupport) _updateConstraintsAtEngineLevelIfNeededWithViewForVariableChangeNotifications:] + 393
    31  UIKitCore                           0x00007fff48563fda -[UIView(Hierarchy) _updateConstraintsAsNecessaryAndApplyLayoutFromEngine] + 272
    32  UIKitCore                           0x00007fff485784bd -[UIView(CALayerDelegate) layoutSublayersOfLayer:] + 2478
    33  QuartzCore                          0x00007fff2b131db1 -[CALayer layoutSublayers] + 255
    34  QuartzCore                          0x00007fff2b137fa3 _ZN2CA5Layer16layout_if_neededEPNS_11TransactionE + 517
    35  UIKitCore                           0x00007fff48563635 -[UIView(Hierarchy) layoutBelowIfNeeded] + 980
    36  UIKitCore                           0x00007fff4856a626 +[UIView(Animation) performWithoutAnimation:] + 84
    37  UIKitCore                           0x00007fff48297660 -[UITableView _createPreparedCellForGlobalRow:withIndexPath:willDisplay:] + 1291
    38  UIKitCore                           0x00007fff4826043b -[UITableView _updateVisibleCellsNow:] + 3081
    39  UIKitCore                           0x00007fff4828055f -[UITableView layoutSubviews] + 194
    40  UIKitCore                           0x00007fff485784bd -[UIView(CALayerDelegate) layoutSublayersOfLayer:] + 2478
    41  QuartzCore                          0x00007fff2b131db1 -[CALayer layoutSublayers] + 255
    42  QuartzCore                          0x00007fff2b137fa3 _ZN2CA5Layer16layout_if_neededEPNS_11TransactionE + 517
    43  QuartzCore                          0x00007fff2b1438da _ZN2CA5Layer28layout_and_display_if_neededEPNS_11TransactionE + 80
    44  QuartzCore                          0x00007fff2b08a848 _ZN2CA7Context18commit_transactionEPNS_11TransactionEd + 324
    45  QuartzCore                          0x00007fff2b0bfb51 _ZN2CA11Transaction6commitEv + 643
    46  QuartzCore                          0x00007fff2b0c04ba _ZN2CA11Transaction17observer_callbackEP19__CFRunLoopObservermPv + 76
    47  CoreFoundation                      0x00007fff23bd3867 __CFRUNLOOP_IS_CALLING_OUT_TO_AN_OBSERVER_CALLBACK_FUNCTION__ + 23
    48  CoreFoundation                      0x00007fff23bce2fe __CFRunLoopDoObservers + 430
    49  CoreFoundation                      0x00007fff23bce97a __CFRunLoopRun + 1514
    50  CoreFoundation                      0x00007fff23bce066 CFRunLoopRunSpecific + 438
    51  GraphicsServices                    0x00007fff384c0bb0 GSEventRunModal + 65
    52  UIKitCore                           0x00007fff48092d4d UIApplicationMain + 1621
    53  Taskmoby                            0x000000010383d12b main + 75
    54  libdyld.dylib                       0x00007fff5227ec25 start + 1
    55  ???                                 0x0000000000000001 0x0 + 1
)
libc++abi.dylib: terminating with uncaught exception of type NSException

now i tried to debug the problem heres what i found:

-the error only happens on iOS 13 -the data coming from the server is complete no missing values or nil values because it works on earlier versions -the error only happens if theres a collectionview cell to be rendered inside the tableview cell i tried changing this function from this:

func collectionView(_ collectionView: UICollectionView, numberOfItemsInSection section: Int) -> Int {
            if(collectionView.tag == servicesData[i].catId){
                return servicesData[i].count
            }
        }

        return 0
    }

to

func collectionView(_ collectionView: UICollectionView, numberOfItemsInSection section: Int) -> Int {
                if(collectionView.tag == servicesData[i].catId){
                    return 0
                }
            }

            return 0
        }

so that no matter what it always returns zero collectionview cell items this makes the tableview cell empty and the error doesnt happen when i do this. its only there when theres a collectionview cell to be rendered inside the tableview cell.

i also double checked all the IBOutlets on the storyboard and the ViewController

and i am using XCode 11

this is very confusing i know but if you can suggest anything that maybe causing this issues i would appreciate it.

Thanks and Sorry for the crappy writing.

I copied your code with the below changes and it works fine on iOS 13 too.

class HomeController: UIViewController, UITableViewDelegate, UITableViewDataSource, UICollectionViewDataSource, UICollectionViewDelegate {

    @IBOutlet weak var homeTable: UITableView!
    var servicesResponse: [String: Any] = [:]
    var someTitles: [String] = ["Test11", "Test22", "Test33"]
    var servicesData: [Cat] = [Cat()]
    var request = NSURLRequest()

    func languageDidChange(){
        tabBarItem.title = NSLocalizedString("home", comment: "")
//        homeTitle.text = NSLocalizedString("browseservice", comment: "")
    }

    @objc func languageDidChangeNotification(notification:NSNotification){
        languageDidChange()
    }
    override func viewDidLoad() {
        super.viewDidLoad()
        NotificationCenter.default.addObserver(self, selector: #selector(languageDidChangeNotification(notification:)), name: NSNotification.Name(rawValue: "LANGUAGE_DID_CHANGE"), object: nil)
        languageDidChange()
//        SVProgressHUD.setDefaultMaskType(.custom)
//        SVProgressHUD.show(withStatus: "Loading...")
//        request.sendRequest("/some/url", headers: [:], method: .get, completion: {serverResponse in
//            if(serverResponse != nil){
                //refresh the tableview when fetching data is complete
                DispatchQueue.main.async {
                    self.homeTable.reloadData()
//                    SVProgressHUD.dismiss()
                }
//            } else {
//                SVProgressHUD.dismiss()
                //show network error dialog
//            }
//        })
        homeTable.delegate = self
        homeTable.dataSource  = self
    }


    let cellSpacingHeight: CGFloat = 0

    func numberOfSections(in tableView:UITableView)->Int{
        //number of categories:vertical
        return 3
    }
    func tableView(_ tableView:UITableView,numberOfRowsInSection section:Int)->Int{
        return 1
    }
    func tableView(_ tableView: UITableView, heightForHeaderInSection section: Int) -> CGFloat {
        return cellSpacingHeight
    }
    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{
        let cell = tableView.dequeueReusableCell(withIdentifier: "CategoryCell") as! CategoryCell

        //set the tabeview as the delegate for the collection view
        cell.collectionView.delegate = self
        cell.collectionView.dataSource = self
        cell.collectionView.reloadData()

        cell.collectionView.tag = indexPath.section

        cell.serviceCategoryName.text = someTitles[indexPath.section]
        return cell
    }
    func tableView(_ tableView: UITableView, heightForRowAt indexPath: IndexPath) -> CGFloat {
        return 100
    }

    func collectionView(_ collectionView: UICollectionView, numberOfItemsInSection section: Int) -> Int {
        for i in 0 ..< servicesData.count {
            //this checks is the current tableview cell is equal to the current collection view cell
            //if it is then the current collectionview cell belongs to the current tableview cell
            //which it will then tell it how many elemnts are in the current tableview cell
            if(collectionView.tag == servicesData[i].catId){
                return servicesData[i].count
            }
        }

        return 0
    }
    func collectionView(_ collectionView: UICollectionView, cellForItemAt indexPath: IndexPath) -> UICollectionViewCell {

        let cell = collectionView.dequeueReusableCell(withReuseIdentifier: "serviceCell", for: indexPath) as! ServiceCollectionCell

        if let data = servicesResponse["data"] as? [Any],
            let cTag = data[collectionView.tag] as? [String: Any],
            let subCat = cTag["subcategories"] as? [Any],
            let rowItem = subCat[indexPath.row] as? [String: Any] {
            if let name = rowItem["name"] as? String {
                cell.serviceName.text = name
            }
            if let photo = rowItem["photo"] as? String {
//            cell.serviceImg.loadImageFromUrl(url: photo)
            }
        }
//        cell.serviceName.text = servicesResponse["data"][collectionView.tag]["subcategories"][indexPath.row]["name"].stringValue
//        let imageUrl = servicesResponse["data"][collectionView.tag]["subcategories"][indexPath.row]["photo"].stringValue
//        cell.serviceImg.loadImageFromUrl(url: imageUrl)

        return cell

    }
    func collectionView(_ collectionView: UICollectionView, didSelectItemAt indexPath: IndexPath) {

        //handle the click
    }

}
class ServiceCollectionCell: UICollectionViewCell {
    //a cell inside the collection view with image and a title
    @IBOutlet weak var serviceImg: UIImageView!
    @IBOutlet weak var serviceName: UILabel!
}
class CategoryCell: UITableViewCell {
    //this is a single tableview cell containg the collection view
    //every tableview cell has a collection view inside it
    @IBOutlet weak var serviceCategoryName: UILabel!
    @IBOutlet weak var collectionView: UICollectionView!
}

class Cat {
    var catId: Int = 0
    var count = 1
}

The code for storyboard is

<?xml version="1.0" encoding="UTF-8"?>
<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="15505" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" useSafeAreas="YES" colorMatched="YES" initialViewController="BYZ-38-t0r">
    <device id="retina6_1" orientation="portrait" appearance="light"/>
    <dependencies>
        <plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="15509"/>
        <capability name="Safe area layout guides" minToolsVersion="9.0"/>
        <capability name="collection view cell content view" minToolsVersion="11.0"/>
        <capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
    </dependencies>
    <scenes>
        <!--View Controller-->
        <scene sceneID="tne-QT-ifu">
            <objects>
                <viewController id="BYZ-38-t0r" customClass="HomeController" customModule="test" customModuleProvider="target" sceneMemberID="viewController">
                    <view key="view" contentMode="scaleToFill" id="8bC-Xf-vdC">
                        <rect key="frame" x="0.0" y="0.0" width="414" height="896"/>
                        <autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
                        <subviews>
                            <tableView clipsSubviews="YES" contentMode="scaleToFill" alwaysBounceVertical="YES" dataMode="prototypes" style="plain" separatorStyle="default" rowHeight="-1" estimatedRowHeight="-1" sectionHeaderHeight="28" sectionFooterHeight="28" translatesAutoresizingMaskIntoConstraints="NO" id="nhS-7j-f3F">
                                <rect key="frame" x="0.0" y="44" width="414" height="818"/>
                                <color key="backgroundColor" systemColor="systemBackgroundColor" cocoaTouchSystemColor="whiteColor"/>
                                <prototypes>
                                    <tableViewCell clipsSubviews="YES" contentMode="scaleToFill" insetsLayoutMarginsFromSafeArea="NO" selectionStyle="blue" hidesAccessoryWhenEditing="NO" indentationLevel="1" indentationWidth="0.0" reuseIdentifier="CategoryCell" rowHeight="200" id="VrW-Ke-kBg" customClass="CategoryCell" customModule="test" customModuleProvider="target">
                                        <rect key="frame" x="0.0" y="28" width="414" height="200"/>
                                        <autoresizingMask key="autoresizingMask"/>
                                        <tableViewCellContentView key="contentView" opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center" insetsLayoutMarginsFromSafeArea="NO" tableViewCell="VrW-Ke-kBg" id="RKz-Go-80Z">
                                            <rect key="frame" x="0.0" y="0.0" width="414" height="200"/>
                                            <autoresizingMask key="autoresizingMask"/>
                                            <subviews>
                                                <label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Label" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="gxd-Hu-fxa">
                                                    <rect key="frame" x="0.0" y="0.0" width="414" height="21"/>
                                                    <constraints>
                                                        <constraint firstAttribute="height" constant="21" id="Hkq-2Q-chn"/>
                                                    </constraints>
                                                    <fontDescription key="fontDescription" type="system" pointSize="17"/>
                                                    <nil key="textColor"/>
                                                    <nil key="highlightedColor"/>
                                                </label>
                                                <collectionView clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="scaleToFill" dataMode="prototypes" translatesAutoresizingMaskIntoConstraints="NO" id="ln8-0Z-wPu">
                                                    <rect key="frame" x="0.0" y="21" width="414" height="179"/>
                                                    <color key="backgroundColor" systemColor="systemBackgroundColor" cocoaTouchSystemColor="whiteColor"/>
                                                    <collectionViewFlowLayout key="collectionViewLayout" automaticEstimatedItemSize="YES" minimumLineSpacing="10" minimumInteritemSpacing="10" id="ydv-5j-rCl">
                                                        <size key="itemSize" width="100" height="100"/>
                                                        <size key="headerReferenceSize" width="0.0" height="0.0"/>
                                                        <size key="footerReferenceSize" width="0.0" height="0.0"/>
                                                        <inset key="sectionInset" minX="0.0" minY="0.0" maxX="0.0" maxY="0.0"/>
                                                    </collectionViewFlowLayout>
                                                    <cells>
                                                        <collectionViewCell opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center" reuseIdentifier="serviceCell" id="LQp-yC-8cB" customClass="ServiceCollectionCell" customModule="test" customModuleProvider="target">
                                                            <rect key="frame" x="0.0" y="0.0" width="100" height="100"/>
                                                            <autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
                                                            <collectionViewCellContentView key="contentView" opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center" insetsLayoutMarginsFromSafeArea="NO" id="8Vu-bZ-RfG">
                                                                <rect key="frame" x="0.0" y="0.0" width="100" height="100"/>
                                                                <autoresizingMask key="autoresizingMask"/>
                                                                <subviews>
                                                                    <label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Label" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="CXV-6d-gQK">
                                                                        <rect key="frame" x="0.0" y="0.0" width="100" height="21"/>
                                                                        <constraints>
                                                                            <constraint firstAttribute="height" constant="21" id="EQX-Bi-KtI"/>
                                                                        </constraints>
                                                                        <fontDescription key="fontDescription" type="system" pointSize="17"/>
                                                                        <nil key="textColor"/>
                                                                        <nil key="highlightedColor"/>
                                                                    </label>
                                                                    <imageView clipsSubviews="YES" userInteractionEnabled="NO" contentMode="scaleAspectFit" horizontalHuggingPriority="251" verticalHuggingPriority="251" image="pencil.circle.fill" catalog="system" translatesAutoresizingMaskIntoConstraints="NO" id="RJK-Aa-V2E">
                                                                        <rect key="frame" x="0.0" y="21.5" width="100" height="78"/>
                                                                    </imageView>
                                                                </subviews>
                                                                <color key="backgroundColor" systemColor="systemTealColor" red="0.35294117650000001" green="0.7843137255" blue="0.98039215690000003" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
                                                                <constraints>
                                                                    <constraint firstItem="RJK-Aa-V2E" firstAttribute="leading" secondItem="CXV-6d-gQK" secondAttribute="leading" id="BWM-6w-bZV"/>
                                                                    <constraint firstAttribute="bottom" secondItem="RJK-Aa-V2E" secondAttribute="bottom" id="bAo-gp-uve"/>
                                                                    <constraint firstItem="RJK-Aa-V2E" firstAttribute="top" secondItem="CXV-6d-gQK" secondAttribute="bottom" id="c1n-ij-MX9"/>
                                                                    <constraint firstItem="CXV-6d-gQK" firstAttribute="leading" secondItem="8Vu-bZ-RfG" secondAttribute="leading" id="eNs-wY-1jn"/>
                                                                    <constraint firstItem="RJK-Aa-V2E" firstAttribute="trailing" secondItem="CXV-6d-gQK" secondAttribute="trailing" id="lOg-qT-oxF"/>
                                                                    <constraint firstAttribute="trailing" secondItem="CXV-6d-gQK" secondAttribute="trailing" id="pt1-Ob-Ebe"/>
                                                                    <constraint firstItem="CXV-6d-gQK" firstAttribute="top" secondItem="8Vu-bZ-RfG" secondAttribute="top" id="tUB-I6-kB6"/>
                                                                </constraints>
                                                            </collectionViewCellContentView>
                                                            <size key="customSize" width="100" height="100"/>
                                                            <connections>
                                                                <outlet property="serviceImg" destination="RJK-Aa-V2E" id="DFl-xu-fIG"/>
                                                                <outlet property="serviceName" destination="CXV-6d-gQK" id="HMy-Nk-ibF"/>
                                                            </connections>
                                                        </collectionViewCell>
                                                    </cells>
                                                    <connections>
                                                        <outlet property="dataSource" destination="VrW-Ke-kBg" id="fDo-ik-rDx"/>
                                                        <outlet property="delegate" destination="VrW-Ke-kBg" id="Lwk-vV-Ifm"/>
                                                    </connections>
                                                </collectionView>
                                            </subviews>
                                            <constraints>
                                                <constraint firstAttribute="trailing" secondItem="gxd-Hu-fxa" secondAttribute="trailing" id="YTd-BP-uW4"/>
                                                <constraint firstItem="ln8-0Z-wPu" firstAttribute="leading" secondItem="gxd-Hu-fxa" secondAttribute="leading" id="dfk-tW-AHH"/>
                                                <constraint firstItem="gxd-Hu-fxa" firstAttribute="top" secondItem="RKz-Go-80Z" secondAttribute="top" id="mMJ-Dj-WNL"/>
                                                <constraint firstItem="ln8-0Z-wPu" firstAttribute="top" secondItem="gxd-Hu-fxa" secondAttribute="bottom" id="sQm-Ig-FPg"/>
                                                <constraint firstItem="ln8-0Z-wPu" firstAttribute="trailing" secondItem="gxd-Hu-fxa" secondAttribute="trailing" id="tY2-gz-ZPw"/>
                                                <constraint firstItem="gxd-Hu-fxa" firstAttribute="leading" secondItem="RKz-Go-80Z" secondAttribute="leading" id="w8J-ZE-qXq"/>
                                                <constraint firstAttribute="bottom" secondItem="ln8-0Z-wPu" secondAttribute="bottom" id="zKH-HT-ryI"/>
                                            </constraints>
                                        </tableViewCellContentView>
                                        <connections>
                                            <outlet property="collectionView" destination="ln8-0Z-wPu" id="gFz-eZ-2NT"/>
                                            <outlet property="serviceCategoryName" destination="gxd-Hu-fxa" id="Ld1-Ne-9wM"/>
                                        </connections>
                                    </tableViewCell>
                                </prototypes>
                                <sections/>
                                <connections>
                                    <outlet property="dataSource" destination="BYZ-38-t0r" id="wk8-DM-4cB"/>
                                    <outlet property="delegate" destination="BYZ-38-t0r" id="ohu-1O-Rlv"/>
                                </connections>
                            </tableView>
                        </subviews>
                        <color key="backgroundColor" systemColor="systemBackgroundColor" cocoaTouchSystemColor="whiteColor"/>
                        <constraints>
                            <constraint firstItem="6Tk-OE-BBY" firstAttribute="top" secondItem="nhS-7j-f3F" secondAttribute="top" id="GJS-DX-9vb"/>
                            <constraint firstItem="nhS-7j-f3F" firstAttribute="leading" secondItem="6Tk-OE-BBY" secondAttribute="leading" id="cq6-Ms-6QE"/>
                            <constraint firstItem="6Tk-OE-BBY" firstAttribute="trailing" secondItem="nhS-7j-f3F" secondAttribute="trailing" id="tGv-ai-93c"/>
                            <constraint firstItem="6Tk-OE-BBY" firstAttribute="bottom" secondItem="nhS-7j-f3F" secondAttribute="bottom" id="x3a-Np-HYC"/>
                        </constraints>
                        <viewLayoutGuide key="safeArea" id="6Tk-OE-BBY"/>
                    </view>
                    <connections>
                        <outlet property="homeTable" destination="nhS-7j-f3F" id="JwT-Ak-X5y"/>
                    </connections>
                </viewController>
                <placeholder placeholderIdentifier="IBFirstResponder" id="dkx-z0-nzr" sceneMemberID="firstResponder"/>
            </objects>
            <point key="canvasLocation" x="139" y="138"/>
        </scene>
    </scenes>
    <resources>
        <image name="pencil.circle.fill" catalog="system" width="64" height="60"/>
    </resources>
</document>

Screenshot of Running app in iOS 13

Hope it helps!

Try to set default empty string values for your UILabels, like

cell.serviceCategoryName.text = someTitles[indexPath.section] ?? ""

and

cell.serviceName.text = 
     servicesResponse["data"][collectionView.tag]["subcategories"][indexPath.row]["name"].stringValue ?? ""

also add some default values (space string, etc.) in UILabel in CategoryCell in Storyboard...

Of course these are just thoughts as I cannot test before suggest, but try.

Update: one more thought - try the following

let value = servicesResponse["data"][collectionView.tag]["subcategories"][indexPath.row]["name"].stringValue
cell.serviceName.text = "\(value)"
Related
Implementing single cell selection to bring up a detail view in swift
How to detect tableView cell touched or clicked in swift
Adding UICollectionViewController to UIViewController Not Working
Expand and Collapse tableview cells
TableView not displaying text with JSON data from API call
Can't implement required methods of JSQMessagesViewController Swift 3
Swift Error - Use of undeclared type 'cell' - Collection View
Swift vertical UICollectionView inside UITableView
How to make Automatic Height Header in UITableView?
Collection View inside UITableView reuse issue