This is the crash log I got from Crashlytics:
Thread : Crashed: com.apple.main-thread
0 Trenìt! 0x1000b93e4 SearchHistoryProvider.getMostRecentStations(Int) -> [String] (SearchHistoryProvider.swift)
1 Trenìt! 0x10007985c specialized MasterViewController.onTouchedTextField(UITextField) -> () (MasterViewController.swift:265)
2 Trenìt! 0x100075414 #objc MasterViewController.onTouchedTextField(UITextField) -> () (MasterViewController.swift)
3 UIKit 0x186fa0ad0 -[UIApplication sendAction:to:from:forEvent:] + 100
4 UIKit 0x186fa0a4c -[UIControl sendAction:to:forEvent:] + 80
5 UIKit 0x186f88740 -[UIControl _sendActionsForEvents:withEvent:] + 436
6 UIKit 0x186fa9248 -[UIControl touchesBegan:withEvent:] + 400
7 UIKit 0x186f9fdc0 -[UIWindow _sendTouchesForEvent:] + 376
8 UIKit 0x186f98b08 -[UIWindow sendEvent:] + 784
9 UIKit 0x186f68f4c -[UIApplication sendEvent:] + 248
10 UIKit 0x186f67528 _UIApplicationHandleEventQueue + 6568
11 CoreFoundation 0x181dd5124 __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE0_PERFORM_FUNCTION__ + 24
12 CoreFoundation 0x181dd4bb8 __CFRunLoopDoSources0 + 540
13 CoreFoundation 0x181dd28b8 __CFRunLoopRun + 724
14 CoreFoundation 0x181cfcd10 CFRunLoopRunSpecific + 384
15 GraphicsServices 0x1835e4088 GSEventRunModal + 180
16 UIKit 0x186fd1f70 UIApplicationMain + 204
17 Trenìt! 0x10009b2fc main (AppDelegate.swift:14)```
(edited)
and this is my code:
MasterViewController.swift:
263 func showRecentStations(textField: UITextField) {
264 textField.text = ""
265 suggestionStations = masterContainerManager!.homeController?.searchHistoryProvider?.getMostRecentStations(10)
266 updateStationsTable(textField)
267 }
SearchHistoryProvider.swift
func getMostRecentStations (maxSize : Int) -> [String] {
let stationsByOldestArray = getRecentStationsByOldest()
let stations = NSMutableOrderedSet()
for i in (0...(stationsByOldestArray.count-1)).reverse() {
stations.addObject(stationsByOldestArray[i].depStation)
if stations.count==maxSize {
return stations.array as! [String]
}
stations.addObject(stationsByOldestArray[i].arrStation)
if stations.count==maxSize {
return stations.array as! [String]
}
}
return stations.array as! [String]
}
Can anyone understand what's the crash about?
I found the bug:
in case stationsByOldestArray.count was 0
the for loop would have been
for i in (0...-1).reverse()
I fixed it by rewriting the loop as
for i in (0..<stationsByOldestArray.count).reverse()
However I think the Swift crash reports are often hopelessly unhelpful!
Related
I have an iOS app that uses Firebase Crashlytics for reporting crashes. Now I have a report for a crash but my problem is that I could not understand what exactly caused the crash from this report.
Crashlytics report:
Crashed: com.apple.main-thread
0 Nail it 0x104db77a8 CaseDetailsViewController.getbaseData() + 253
(CaseDetailsViewController.swift:253)
1 Nail it 0x104db5168 CaseDetailsViewController.viewDidLoad() + 4335047016 (<compiler-generated>:4335047016)
2 Nail it 0x104db521c #objc CaseDetailsViewController.viewDidLoad() + 4335047196 (<compiler-generated>:4335047196)
3 UIKitCore 0x185d11658 -[UIViewController _sendViewDidLoadWithAppearanceProxyObjectTaggingEnabled] + 100
4 UIKitCore 0x185d160e8 -[UIViewController loadViewIfRequired] + 936
5 UIKitCore 0x185d164f0 -[UIViewController view] + 28
6 UIKit 0x1b913374c -[UIViewControllerAccessibility dismissViewControllerWithTransition:completion:] + 268
7 UIKitCore 0x185d28d6c -[UIViewController _performCoordinatedPresentOrDismiss:animated:] + 508
8 UIKitCore 0x185d2b474 -[UIViewController dismissViewControllerAnimated:completion:] + 132
9 UIKit 0x1b91333c0 -[UIViewControllerAccessibility dismissViewControllerAnimated:completion:] + 120
10 Nail it 0x104db98ec #objc CaseDetailsViewController.backButton(_:) + 4335065324 (<compiler-generated>:4335065324)
11 UIKitCore 0x18635a72c -[UIApplication sendAction:to:from:forEvent:] + 96
12 UIKitCore 0x185a05474 __45-[_UIButtonBarTargetAction _invoke:forEvent:]_block_invoke + 80
13 UIKitCore 0x185a05304 -[_UIButtonBarTargetAction _invoke:forEvent:] + 236
14 UIKitCore 0x18635a72c -[UIApplication sendAction:to:from:forEvent:] + 96
15 UIKitCore 0x185d6aed0 -[UIControl sendAction:to:forEvent:] + 240
16 UIKitCore 0x185d6b228 -[UIControl _sendActionsForEvents:withEvent:] + 396
17 UIKitCore 0x185d6a24c -[UIControl touchesEnded:withEvent:] + 516
18 UIKitCore 0x18639449c -[UIWindow _sendTouchesForEvent:] + 1280
19 UIKitCore 0x186395c64 -[UIWindow sendEvent:] + 3468
20 UIKitCore 0x1863718ec -[UIApplication sendEvent:] + 344
21 UIKit 0x1b90db80c -[UIApplicationAccessibility sendEvent:] + 96
22 UIKitCore 0x1863f2970 __dispatchPreprocessedEventFromEventQueue + 6808
23 UIKitCore 0x1863f54ec __handleEventQueueInternal + 5364
24 UIKitCore 0x1863ed168 __handleHIDEventFetcherDrain + 140
25 CoreFoundation 0x182223ad8 __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE0_PERFORM_FUNCTION__ + 24
26 CoreFoundation 0x182223a30 __CFRunLoopDoSource0 + 80
27 CoreFoundation 0x1822231b8 __CFRunLoopDoSources0 + 184
28 CoreFoundation 0x18221e1e8 __CFRunLoopRun + 788
29 CoreFoundation 0x18221dba8 CFRunLoopRunSpecific + 424
30 GraphicsServices 0x18c394344 GSEventRunModal + 160
31 UIKitCore 0x1863593e4 UIApplicationMain + 1932
32 Nail it 0x104d797cc main + 16 (AppDelegate.swift:16)
33 libdyld.dylib 0x1820a58f0 start + 4
Below is the function getBaseData() from CasesDetails View Controller:
func getbaseData(){
let userDefaults = UserDefaults.standard
mobile = userDefaults.value(forKey: "mobile") as! String
altenativeMobile = userDefaults.string(forKey: "altenativeMobile") ?? mobile
privateKey = userDefaults.value(forKey: "privateKey") as! String
////reading JSON
let categoriesJsonString = userDefaults.value(forKey: "categoriesString") as! String
let data = categoriesJsonString.data(using: .utf8)!
if let json = try? JSON(data: data) {
let arrayCats = json["content"][1]["caseMappings"][caseCategoryGlobal].array
if(isNoSubsGlob == 0){
if let arrayCatsCount = arrayCats?.count {
print("The array has been created with \(arrayCatsCount) element")
print("sub1Glob= \(sub1Glob) & sub2Glob= \(sub2Glob)")
for var i in 0..<arrayCatsCount{
let sub1 = json["content"][1]["caseMappings"][caseCategoryGlobal][i]["sub1"].string!
let sub2 = json["content"][1]["caseMappings"][caseCategoryGlobal][i]["sub2"].string ?? ""
if (sub1 == sub1Glob && sub2 == sub2Glob){
departmentId = json["content"][1]["caseMappings"][caseCategoryGlobal][i]["departmentId"].int!
WorkTypeId = json["content"][1]["caseMappings"][caseCategoryGlobal][i]["categoryId"].int!
issueCode = json["content"][1]["caseMappings"][caseCategoryGlobal][i]["id"].int!
}
}
}
}else{
departmentId = json["content"][1]["caseMappings"][caseCategoryGlobal][0]["departmentId"].int!
WorkTypeId = json["content"][1]["caseMappings"][caseCategoryGlobal][0]["categoryId"].int!
issueCode = json["content"][1]["caseMappings"][caseCategoryGlobal][0]["id"].int!
}
}
contactNumberText.text = altenativeMobile
}
and the line 235 is (contactNumberText.text = altenativeMobile) as the last line in the code above
All UI stuff should be performed on main thread, that is what your crash report shows (crash due to main thread.)
So your last line should be :
DispatchQueue.main.async {
self.contactNumberText.text = altenativeMobile
}
Update this line, your crash will fixed.
I am unable to replicate this issue, how to replicate the following fabric crash ?
Is there a way to open this crash in xcode (Importing crash into xcode)
Crashed: com.apple.main-thread
0 ABCC 0x10092d0c4 specialized ABCViewController.signInBtnPressed(UIButton) -> ()(ABCViewController.swift:178)
1 ABCC 0x10092a520 #objc ABCViewController.unwind(UIStoryboardSegue) -> () + 3152641510
2 UIKit 0x18aced64c -[UIApplication sendAction:to:from:forEvent:] + 86
3 UIKit 0x18ae0e870 -[UIControl sendAction:to:forEvent:] + 52
4 UIKit 0x18acf3700 -[UIControl _sendActionsForEvents:withEvent:] + 120
5 UIKit 0x18ae291a8 -[UIControl touchesEnded:withEvent:] + 492
6 UIKit 0x18b2ceee8 _UIGestureEnvironmentSortAndSendDelayedTouches + 4340
7 UIKit 0x18b2cbc60 _UIGestureEnvironmentUpdate + 1236
8 UIKit 0x18ad664d8 -[UIGestureEnvironment _deliverEvent:toGestureRecognizers:usingBlock:] + 404
9 UIKit 0x18ad66010 -[UIGestureEnvironment _updateGesturesForEvent:window:] + 276
10 UIKit 0x18ad65874 -[UIWindow sendEvent:] + 3132
11 UIKit 0x18ad641d0 -[UIApplication sendEvent:] + 340
12 UIKit 0x18b545d1c __dispatchPreprocessedEventFromEventQueue + 2340
13 UIKit 0x18b5482c8 __handleEventQueueInternal + 4744
14 CoreFoundation 0x180f27404 __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE0_PERFORM_FUNCTION__ + 24
15 CoreFoundation 0x180f26c2c __CFRunLoopDoSources0 + 276
16 CoreFoundation 0x180f2479c __CFRunLoopRun + 1204
17 CoreFoundation 0x180e44da8 CFRunLoopRunSpecific + 552
18 GraphicsServices 0x182e2a020 GSEventRunModal + 100
19 UIKit 0x18ae64758 UIApplicationMain + 236
20 ABCC 0x1007b28c4 main (main.m:20)
21 libdyld.dylib 0x1808d5fc0 start + 4
Here is the code for the action that is crashing.
#IBAction func signInBtnPressed(_ sender: UIButton) {
sender.isUserInteractionEnabled = false
guard let employees = UserService.shared.employees, let name = employees.names?[sender.tag] else {
sender.isUserInteractionEnabled = true // crashing here
return
}
// perform task
sender.isUserInteractionEnabled = true
}
I'm getting these crash reports from XCode (I pasted one at the bottom) and I can't reproduce the error or figure out what the problem is.
From the backtrace I'm thinking it could be related to the decodeObject stuff… I did have some problems with the new decodeBool and decodeDouble functions, so to be sure I made an NSCoder extension:
func safeDecodeDouble(key: String) -> Double? {
if self.containsValue(forKey: key) {
if let value = self.decodeObject(forKey: key) as? Double {
return value
}
return self.decodeDouble(forKey: key)
}
return nil
}
func safeDecodeBool(key: String) -> Bool? {
if self.containsValue(forKey: key) {
if let value = self.decodeObject(forKey: key) as? Bool {
return value
}
return self.decodeBool(forKey: key)
}
return nil
}
func safeDecodeDate(key: String) -> Date? {
if self.containsValue(forKey: key) {
if let value = self.decodeObject(forKey: key) as? Date {
return value
}
}
return nil
}
func safeDecodeString(key: String) -> String? {
if self.containsValue(forKey: key) {
if let value = self.decodeObject(forKey: key) as? String {
return value
}
}
return nil
}
Now I only use the safeDecode functions in my code, but I'm still getting those same crash reports.
The third item in the backtrace says [UIStoryboard storyboardWithName:bundle:], but I don't know what that could have to do with anything. Also every crash report has something about state restoration and decodeObject, so I'm thinking the problem isn't the storyboard instantiation per se.
At the same time I never have any problems when I test state restoration on the simulator or on my devices, so apparently it's only happening to some people.
Any ideas on what could be going on here?
Last Exception Backtrace:
0 CoreFoundation 0x18a146fd8 __exceptionPreprocess + 124 (NSException.m:165)
1 libobjc.A.dylib 0x188ba8538 objc_exception_throw + 56 (objc-exception.mm:521)
2 UIKit 0x190a36850 +[UIStoryboard storyboardWithName:bundle:] + 776 (UIStoryboard.m:99)
3 UIKit 0x190bfacfc -[_UIStoryboardProxy initWithCoder:] + 192 (UIStateRestorationSupport.m:324)
4 Foundation 0x18ab96420 _decodeObjectBinary + 2076 (NSKeyedArchiver.m:2304)
5 Foundation 0x18ab95b58 _decodeObject + 308 (NSKeyedArchiver.m:2467)
6 UIKit 0x1903e62ec -[UIStateRestorationKeyedUnarchiver decodeObjectForKey:] + 88 (UIStateRestorationSupport.m:454)
7 UIKit 0x1903e5ba8 -[UIApplication(StateRestoration) _restoreApplicationPreservationStateWithSessionIdentifier:beginHandler:completionHandler:] + 4772 (UIApplication.m:13551)
8 UIKit 0x1902e76b4 -[UIApplication(StateRestoration) _doRestorationIfNecessary] + 244 (UIApplication.m:13979)
9 UIKit 0x1902e7288 -[UIApplication _handleDelegateCallbacksWithOptions:isSuspended:restoreState:] + 296 (UIApplication.m:1792)
10 UIKit 0x1904f3800 -[UIApplication _callInitializationDelegatesForMainScene:transitionContext:] + 3452 (UIApplication.m:2129)
11 UIKit 0x1904f92a8 -[UIApplication _runWithMainScene:transitionContext:completion:] + 1684 (UIApplication.m:3625)
12 UIKit 0x19050dde0 __84-[UIApplication _handleApplicationActivationWithScene:transitionContext:completion:]_block_invoke.3151 + 48 (UIApplication.m:10365)
13 UIKit 0x1904f653c -[UIApplication workspaceDidEndTransaction:] + 168 (UIApplication.m:2990)
14 FrontBoardServices 0x18bcef884 __FBSSERIALQUEUE_IS_CALLING_OUT_TO_A_BLOCK__ + 36 (FBSSerialQueue.m:158)
15 FrontBoardServices 0x18bcef6f0 -[FBSSerialQueue _performNext] + 176 (FBSSerialQueue.m:177)
16 FrontBoardServices 0x18bcefaa0 -[FBSSerialQueue _performNextFromRunLoopSource] + 56 (FBSSerialQueue.m:206)
17 CoreFoundation 0x18a0f5424 __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE0_PERFORM_FUNCTION__ + 24 (CFRunLoop.c:1943)
18 CoreFoundation 0x18a0f4d94 __CFRunLoopDoSources0 + 540 (CFRunLoop.c:1989)
19 CoreFoundation 0x18a0f29a0 __CFRunLoopRun + 744 (CFRunLoop.c:2821)
20 CoreFoundation 0x18a022d94 CFRunLoopRunSpecific + 424 (CFRunLoop.c:3113)
21 UIKit 0x1902e045c -[UIApplication _run] + 652 (UIApplication.m:2658)
22 UIKit 0x1902db130 UIApplicationMain + 208 (UIApplication.m:4089)
23 Leio 0x1000b6ecc main + 120 (BookInfoTableViewController.swift:19)
24 libdyld.dylib 0x18903159c start + 4
Edit: Here's a different crash report that showed up and suggests there really is a problem with state restoration. I can never reproduce it myself, though. :/
0 CoreFoundation 0x18385adb0 __exceptionPreprocess + 124 (NSException.m:162)
1 libobjc.A.dylib 0x182ebff80 objc_exception_throw + 56 (objc-exception.mm:531)
2 Foundation 0x1841d4704 -[NSCoder(Exceptions) __failWithException:] + 132 (NSCoder.m:544)
3 Foundation 0x1841d48bc -[NSCoder(Exceptions) __failWithExceptionName:errorCode:format:] + 440 (NSCoder.m:580)
4 Foundation 0x1841a33b8 _decodeObjectBinary + 2996 (NSKeyedArchiver.m:2173)
5 Foundation 0x1841a274c _decodeObject + 304 (NSKeyedArchiver.m:2313)
6 UIKit 0x188b3e20c -[UIStateRestorationKeyedUnarchiver decodeObjectForKey:] + 88 (UIStateRestorationSupport.m:454)
7 UIKit 0x188b3daf8 -[UIApplication(StateRestoration) _restoreApplicationPreservationStateWithSessionIdentifier:beginHandler:completionHandler:] + 4908 (UIApplication.m:15043)
8 UIKit 0x188a32d44 -[UIApplication(StateRestoration) _doRestorationIfNecessary] + 244 (UIApplication.m:15471)
9 UIKit 0x188a32964 -[UIApplication _handleDelegateCallbacksWithOptions:isSuspended:restoreState:] + 308 (UIApplication.m:1860)
10 UIKit 0x188c62184 -[UIApplication _callInitializationDelegatesForMainScene:transitionContext:] + 2904 (UIApplication.m:2112)
11 UIKit 0x188c665f0 -[UIApplication _runWithMainScene:transitionContext:completion:] + 1684 (UIApplication.m:3355)
12 UIKit 0x188c63764 -[UIApplication workspaceDidEndTransaction:] + 168 (UIApplication.m:2748)
13 FrontBoardServices 0x1851fb7ac __FBSSERIALQUEUE_IS_CALLING_OUT_TO_A_BLOCK__ + 36 (FBSSerialQueue.m:158)
14 FrontBoardServices 0x1851fb618 -[FBSSerialQueue _performNext] + 168 (FBSSerialQueue.m:177)
15 FrontBoardServices 0x1851fb9c8 -[FBSSerialQueue _performNextFromRunLoopSource] + 56 (FBSSerialQueue.m:206)
16 CoreFoundation 0x18381109c __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE0_PERFORM_FUNCTION__ + 24 (CFRunLoop.c:1761)
17 CoreFoundation 0x183810b30 __CFRunLoopDoSources0 + 540 (CFRunLoop.c:1807)
18 CoreFoundation 0x18380e830 __CFRunLoopRun + 724 (CFRunLoop.c:2536)
19 CoreFoundation 0x183738c50 CFRunLoopRunSpecific + 384 (CFRunLoop.c:2814)
20 UIKit 0x188a2b94c -[UIApplication _run] + 460 (UIApplication.m:2578)
21 UIKit 0x188a26088 UIApplicationMain + 204 (UIApplication.m:3772)
22 Leio 0x1000f6ecc main + 120 (BookInfoTableViewController.swift:19)
23 libdyld.dylib 0x1832d68b8 start + 4 (start_glue.s:78)
I am having three buttons in table view cell when click on button it is crashed strangely in line I am attaching code and crash report please suggest a solution.
Code for button click:
#IBAction func ibaReject(sender: UIButton) {
let notification = notifications[sender.tag]
let notificationHandler = NotificationHandlerFactory.getNotificationHandler(notification)
notificationHandler?.handleNegativeAction(notification,viewController: self)
}
Crash report from crashlytics:
Crashed: com.apple.main-thread
0 Quickride 0x1000c589c specialized NotificationViewController.ibaReject(UIButton) -> () (NotificationViewController.swift)
1 Quickride 0x1000c2d28 #objc NotificationViewController.ibaReject(UIButton) -> () (NotificationViewController.swift)
2 UIKit 0x18d31e7b0 -[UIApplication sendAction:to:from:forEvent:] + 96
3 UIKit 0x18d31e730 -[UIControl sendAction:to:forEvent:] + 80
4 UIKit 0x18d308be4 -[UIControl _sendActionsForEvents:withEvent:] + 452
5 UIKit 0x18d31e01c -[UIControl touchesEnded:withEvent:] + 584
6 UIKit 0x18d31db44 -[UIWindow _sendTouchesForEvent:] + 2484
7 UIKit 0x18d318d8c -[UIWindow sendEvent:] + 2988
8 UIKit 0x18d2e9858 -[UIApplication sendEvent:] + 340
9 UIKit 0x18dad6cb8 __dispatchPreprocessedEventFromEventQueue + 2736
10 UIKit 0x18dad0720 __handleEventQueue + 784
11 CoreFoundation 0x18744e278 __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE0_PERFORM_FUNCTION__ + 24
12 CoreFoundation 0x18744dbc0 __CFRunLoopDoSources0 + 524
13 CoreFoundation 0x18744b7c0 __CFRunLoopRun + 804
14 CoreFoundation 0x18737a048 CFRunLoopRunSpecific + 444
15 GraphicsServices 0x188dfd198 GSEventRunModal + 180
16 UIKit 0x18d354628 -[UIApplication _run] + 684
17 UIKit 0x18d34f360 UIApplicationMain + 208
18 Quickride 0x1002d4018 main (AppDelegate.swift:23)
19 libdispatch.dylib 0x18635c5b8 (Missing)
So, as a novice IOS developer I find it hard to determine what cases this exception.
Case: the IOS app has a UIScrollView that allows the user to drag down to sync with a web service - just like the build in mail app.
Once in a while a user in the wild will encounter an app crash. In crashlytics i see:
Crashed: com.apple.main-thread: EXC_BREAKPOINT 0x00000000e7ffdefe
0 myApp 0xba760 specialized WeekPlanController.scrollViewWillBeginDragging(UIScrollView) -> () (WeekPlanController.swift:428)
1 myApp 0xba4a0 specialized WeekPlanController.scrollViewWillBeginDragging(UIScrollView) -> () (WeekPlanController.swift:428)
2 myApp 0xb702c #objc WeekPlanController.scrollViewWillBeginDragging(UIScrollView) -> () (WeekPlanController.swift)
3 UIKit 0x2cee4ad3 -[UIScrollView _updatePanGesture] + 282
4 UIKit 0x2ced206b _UIGestureRecognizerSendActions + 294
5 UIKit 0x2cd810f9 -[UIGestureRecognizer _updateGestureWithEvent:buttonEvent:] + 668
6 UIKit 0x2d19af9b ___UIGestureRecognizerUpdate_block_invoke661 + 46
7 UIKit 0x2cd4a181 _UIGestureRecognizerRemoveObjectsFromArrayAndApplyBlocks + 216
8 UIKit 0x2cd4805f _UIGestureRecognizerUpdate + 2926
9 UIKit 0x2cd7f4d9 -[UIWindow _sendGesturesForEvent:] + 784
10 UIKit 0x2cd7eddd -[UIWindow sendEvent:] + 524
11 UIKit 0x2cd54fe5 -[UIApplication sendEvent:] + 196
12 UIKit 0x2cfcb8fb _UIApplicationHandleEventFromQueueEvent + 14414
13 UIKit 0x2cd539f9 _UIApplicationHandleEventQueue + 1352
14 CoreFoundation 0x296c5faf __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE0_PERFORM_FUNCTION__ + 14
15 CoreFoundation 0x296c53bf __CFRunLoopDoSources0 + 218
16 CoreFoundation 0x296c3a25 __CFRunLoopRun + 772
17 CoreFoundation 0x29610201 CFRunLoopRunSpecific + 476
18 CoreFoundation 0x29610013 CFRunLoopRunInMode + 106
19 GraphicsServices 0x30eef201 GSEventRunModal + 136
20 UIKit 0x2cdb4a59 UIApplicationMain + 1440
21 myApp 0x5d084 main (AppDelegate.swift:14)
22 libdyld.dylib 0x37f3daaf start + 2
This is the code from the controller:
func scrollViewWillBeginDragging(scrollView: UIScrollView){
if Settings.isSyncActive {
if let lastSyncDate = Settings.lastSyncedDate { // ln 427
self.refreshControl.attributedTitle = NSAttributedString(string: "Last sync \(lastSyncDate.relativeTimeToString()) ago") // ln 428
} // ln 429
else{
self.refreshControl.attributedTitle = NSAttributedString(string: "")
}
}
}
Any hint or tips are appreciated