9 Notes September 2020
1. Difference between unowned and weak
The difference between unowned and weak is that weak is declared as an Optional while unowned is not. By declaring it weak you get to handle the case that it might be nil inside the closure at some point. If you try to access an unowned variable that happens to be nil, it will crash the whole program. So only use unowned when you are positive that variable will always be around while the closure is around
example :
- Not optional
UIView.animate(withDuration: 0.1) { [unowned self] in
// test here
}
- if condition is optional
UIView.animate(withDuration: 0.1) { [weak self] in
// test here
}
source: https://stackoverflow.com/a/24320474/8366535
2. Reason: image not found
This how to fixing if you found this error in debug area
dyld: Library not loaded: @rpath/GTMSessionFetcher.framework/GTMSessionFetcher
Referenced from: /Users/user/Library/Developer/Xcode/DerivedData/app-fdbtvslxujpubfeopseixqoigrp/Build/Products/Debug-iphonesimulator/Common.framework/Common
Reason: image not found
(lldb)
Solution:
In the terminal, do a pod update -> pod install -> clean and run project
this work in my case .
Or try
delete DrivedData and build again
Source: https://github.com/Alamofire/Alamofire/issues/3051#issuecomment-580003683
3. UIView Auto constrain inside stackView
In condition have a view inside stack view and have stack view inside view like this
stackView -> View -> Stackview
so the solution is
1. set constraint 2nd stackview top, landing, trailing and bottom to view
2. set view height Grether than equal with minimum constant
4. Error "Return from initializer without initializing all stored properties"
If found error "Return from initializer without initializing all stored properties"
Solution In my case is, Error in code below:
public struct CardObject: Codable {
public let productName: String?
public let cardName: String?
}
that because model use let constant, for fixing change "let" to "var"
public struct CardObject: Codable {
public var productName: String?
public var cardName: String?
}
5. Error " cannot convert value of type 'Int' to expected argument type 'DispatchTimeInterval' "
If found this error in jenkins and run unit test in xcode "Success"
error like this cannot convert value of type 'Int' to expected argument type 'DispatchTimeInterval'
so solution update your pods and build again for Unit test
6. Overriding declarations in extensions is not supported
From
public extension viewController {
public func testClass() {}
public func testClassTwo() {}
}
To like this
public class viewController {
override func viewDidLoad() {
super.viewDidLoad()
}
public func testClass() {}
public func testClassTwo() {}
}
7. Error CryptoSwift need update pods version
[!] `CryptoSwift` requires CocoaPods version `>= 1.9.1`, which is not satisfied by your current version, `1.8.3`.
solution is update pods version in terminal
$sudo gem install cocoapods
8. Error requires CocoaPods version in Jenkins
Update gemfile and Gemfile.lock
$bundle update
Or you can use this too $bundle install --path vendor/bundle
This in gemfile.lock before and after update
9. Error in Jenkins CFBundleShortVersionString must be higher
No comments: