Reason for error: The control may not be associated with a definition in the code.
Solution one: Second, click the control, drag the dot to the control in the interface from Show the Connections Inspector, select the correct control and make the connection. Leave the object unreleased and remove the weak keyword.
Solution 2: Use the Guard keyword for judgment.
Solution one: Second, click the control, drag the dot to the control in the interface from Show the Connections Inspector, select the correct control and make the connection. Leave the object unreleased and remove the weak keyword.
Solution 2: Use the Guard keyword for judgment.
1, the judgment is not empty
If the sender. TitleLabel. Text! = nil {
Print (” Contains a value!” )
} else {
Print (” Doesn ‘t contain a value. “)
}
2. Optional binding
If let text = sender.titlelabel.text {
Print (” Contains a value! It is \(number)!” )
} else {
Print (” Doesn ‘t contain a number “)
}
3. Guard statement
Guard let text = sender.titlelabel.text else {
The return
}
Read More:
- Swift Error fatal error: unexpectedly found nil while unwrapping an Optional value
- NPM warn optional skipping optional dependency: 1 [email protected] (node_ modules\fsevents):
- IIS + Django project reported an error. The fastcgi process exited unexpectedly
- Android studio reported an error in the release package: Lint found fatal errors while assembling a release target
- Error reporting and resolution of #selector above swift5
- Swift error: abort trap: 6
- IOS swift error
- ImportError: cannot import name ‘Optional‘ from ‘torch.jit.annotations‘ (F:\Python37\lib\site-packag
- comparison of Fixnum with nil failed
- Solve fatal error: ‘FFI. H’ file not found
- Error: MySQL shutdown unexpectedly
- Fatal error in PHP project: class’ redis’ not found
- import Error:Missing optional dependency ‘openpyxl‘. Use pip or conda to install openpyxl
- fatal error LNK1169: one or more multiply defined symbols found
- Execution failed for task :Test:lintVitalRelease/Lint found fatal errors while assembling a release
- PHP:Fatal error: Class ‘COM’ not found in … How to deal with the problem
- Failed connect to github.com:443 ; no error and the remote end hung up unexpectedly
- Remote sshd prompt: server unexpectedly closed network connection
- The springboot integration mybatis reported an error. The parameter cannot be found
- IOFileUploadException: Processing of multipart/form-data request failed. Stream ended unexpectedly