Tag Archives: ios

Error reporting and resolution of #selector above swift5

Error reporting and resolution of #selector above swift5

The version of swift has changed a lot recently. If you add an event to a button, you must be very skilled in OC. How do you define functions and pass parameters in
swift

 let btn = UIButton()
 btn.tag = 2
 btn.addTarget(self, action: #selector(buttonClick(button:)), for: .touchUpInside)

  @objc func buttonClick(button: UIButton) {
       button.isSelected = true
       print(btn.tag!)
        print("\(btn.tag)")
 }

The custom method must be preceded by @ objc to follow the OC mechanism, otherwise an error will be reported

Xcode12.5 package framework error [How to Solve]

1. General

Today, Xcode was upgraded to 12.5.1. When compiling the existing project, the problem of swift incompatibility reported by referring to the framework compiled by swift appeared again. According to previous experience, just pack it again with the latest version of Xcode, but my colleague recommended a configuration to avoid the problem of swift incompatibility in the later stage, but this configuration was set, But it triggered a series of changes.

2. Project configuration and script modification

2.1. Modify the build libraries for distribution configuration item

This upgrade will ‘build settings’ – & gt` Build Options`->` Build libraries for distribution ` is set to yes, which has solved the problem of incompatibility in the later stage (it is set temporarily and needs to be verified in the later stage).

two point two   Modify project build system

Because ‘build libraries for distribution’ is set to yes, ‘project settings’ – & gt; under’ file ‘in the Project menu` Build system needs to be changed from ‘legacy build system’ to ‘new build system (default)’. Otherwise, packaging will fail with the following error.

  two point three   Modify the universal aggregate script file

Our project uses a universalaggregate script file to execute the other two script files. One is xxxxkitaggregate of IOS_ IOS, one is xxxxkitaggregate of tvos_ tvOS。 In the universalaggregate script, add ` – usemodernbuildsystem = no ‘after the two instructions respectively. If it is set to no, it means that the build system adopts’ legacy build system’, and if it is set to yes, it adopts’ new build system (default) ‘. As follows:

xcodebuild -target "XXXXKitAggregate_iOS" BUILD_DIR="${BUILD_DIR}" -UseModernBuildSystem=NO
xcodebuild -target "XXXXKitAggregate_tvOS" BUILD_DIR="${BUILD_DIR}" -UseModernBuildSystem=NO

Add ` – usemodernbuildsystem = no ‘to avoid disk read-write errors caused by simultaneous packaging of IOS and tvos
the error is as follows:

--error: error: accessing build database "xxx/build/XCBuildData/build.db": disk I/O error

Or:

accessing build database "/Users/xxxx/Work/Git/NLDFramework/XXXToolKit/build/XCBuildData/build.db": database is locked Possibly there are two concurrent builds running in the same filesystem location.

2.4 modify the packaging script (xxxxkitaggregate_ios, xxxxkitaggregate_tvos)

Add ‘RM – RF ${build_dir}’ before the ‘xcodebuild – target “XXXX’ command, and remove ‘clean’ from the ‘xcodebuild’ command, as shown in the following figure:

Before each build, delete the build file directory to avoid the following errors:

Could not delete `/Users/xxxx/Work/Git/NLDFramework/XXXMenuKit/build` because it was not created by the build system.

2.5 modify the configuration in Jenkins project

If the framework is packaged through Jenkins, you need to find the build configuration under the corresponding project configuration in Jenkins and check ‘allow failing build results’. Otherwise, Jenkins packaging will fail due to disk read-write exceptions. Check it, that is, ignore the exceptions and put the packaged framework in the specified location.

If not checked, Jenkins’s final output results are as follows:

When checked, Jenkins’s final output results are as follows:

ERROR ITMS-90022: “Missing required icon file. [How to Solve]

1. Problem

ERROR ITMS-90022: “Missing required icon file. The bundle does not contain an app icon for iPhone/iPod Touch of exactly ‘120×120’ pixels, in .png format for iOS versions >= 10.0. To support older versions of iOS, the icon may be required in the bundle outside of an asset catalog. Make sure the Info.plist file includes appropriate entries referencing the file. See https://developer.apple.com/documentation/bundleresources/information_property_list/user_interface”


2. Solution: Just make sure there are 120×120 icons in the AppIcon

LSSchemaConfigureForStore failed with error Error Domain=NSOSStatusErrorDomain Code=-10817 “(null)“

LSSchemaConfigureForStore failed with error Error Domain=NSOSStatusErrorDomain Code=-10817 "(null)" UserInfo={_LSFunction=_LSSchemaConfigureForStore, ExpectedSimulatorHash={length = 32, bytes = 0x15dde658 ed2a1267 ab2496d7 34f186ad ... ec431c65 02d68f35 }, _LSLine=409, WrongSimulatorHash={length = 32, bytes = 0xaf25dda9 e45baa35 610eaabd 5bc09901 ... 9cbe61f3 81d7b9d9 }}

  The solution is as follows:

The problem of error reporting caused by fluent swift

flutter oc-based flutter project using swift-based plugin leads to error reporting problem
Xcode’s output:

ld: warning: Could not find or use auto-linked library ‘swiftCoreGraphics’
ld: warning: Could not find or use auto-linked library ‘swiftDarwin’
ld: warning: Could not find or use auto-linked library ‘swiftUIKit’
ld: warning: Could not find or use auto-linked library ‘swiftFoundation’
ld: warning: Could not find or use auto-linked library ‘swiftCompatibility51’
ld: warning: Could not find or use auto-linked library ‘swiftMetal’
ld: warning: Could not find or use auto-linked library ‘swiftObjectiveC’
ld: warning: Could not find or use auto-linked library ‘swiftCoreFoundation’
ld: warning: Could not find or use auto-linked library ‘swiftCompatibility50’
ld: warning: Could not find or use auto-linked library ‘swiftCoreImage’
ld: warning: Could not find or use auto-linked library
‘swiftCompatibilityDynamicReplacements’
ld: warning: Could not find or use auto-linked library ‘swiftDispatch’
ld: warning: Could not find or use auto-linked library ‘swiftCoreMedia’
ld: warning: Could not find or use auto-linked library ‘swiftQuartzCore’
ld: warning: Could not find or use auto-linked library ‘swiftCore’
ld: warning: Could not find or use auto-linked library ‘swiftCoreAudio’
ld: warning: Could not find or use auto-linked library ‘swiftSwiftOnoneSupport’
Undefined symbols for architecture x86_64:
“value witness table for Builtin.UnknownObject”, referenced from:
full type metadata for kzcity_picker.SwiftKzcityPickerPlugin in
libkzcity_picker.a(SwiftKzcityPickerPlugin.o)
“_swift_FORCE_LOADKaTeX parse error: Expected group after ‘_’ at position 69: …rom: _̲_swift_FORCE_LO…swiftCompatibilityDynamicReplacementsKaTeX parse error: Expected group after ‘_’ at position 111: …eant: _̲_swift_FORCE_LO…swiftCompatibilityDynamicReplacementsKaTeX parse error: Expected group after ‘_’ at position 24: …picker) “_̲_swift_FORCE_LO…_swiftCompatibility51”, referenced from:
_swift_FORCE_LOADKaTeX parse error: Expected group after ‘_’ at position 22: …Compatibility51_̲_kzcity_picker in
libkzcity_picker.a(SwiftKzcityPickerPlugin.o)
(maybe you meant: _swift_FORCE_LOADKaTeX parse error: Expected group after ‘_’ at position 22: …Compatibility51_̲_kzcity_picker)
“_swift_FORCE_LOADKaTeX parse error: Expected group after ‘_’ at position 52: …rom: _̲_swift_FORCE_LO…swiftCompatibility50KaTeX parse error: Expected group after ‘_’ at position 102: …ybe you meant: _̲_swift_FORCE_LO…swiftCompatibility50KaTeX parse error: Expected group after ‘_’ at position 24: …picker) “_̲_swift_FORCE_LO…_swiftQuartzCore”, referenced from:
_swift_FORCE_LOADKaTeX parse error: Expected group after ‘_’ at position 17: …swiftQuartzCore_̲_kzcity_picker in
libkzcity_picker.a(SwiftKzcityPickerPlugin.o)
(maybe you meant: _swift_FORCE_LOADKaTeX parse error: Expected group after ‘_’ at position 17: …swiftQuartzCore_̲_kzcity_picker)
“_swift_FORCE_LOADKaTeX parse error: Expected group after ‘_’ at position 46: …rom: _̲_swift_FORCE_LO…swiftCoreImageKaTeX parse error: Expected group after ‘_’ at position 102: …ybe you meant: _̲_swift_FORCE_LO…swiftCoreImageKaTeX parse error: Expected group after ‘_’ at position 24: …picker) “_̲_swift_FORCE_LO…_swiftCoreGraphics”, referenced from:
_swift_FORCE_LOADKaTeX parse error: Expected group after ‘_’ at position 19: …iftCoreGraphics_̲_kzcity_picker in
libkzcity_picker.a(SwiftKzcityPickerPlugin.o)
(maybe you meant: _swift_FORCE_LOADKaTeX parse error: Expected group after ‘_’ at position 19: …iftCoreGraphics_̲_kzcity_picker)
“_swift_FORCE_LOADKaTeX parse error: Expected group after ‘_’ at position 51: …rom: _̲_swift_FORCE_LO…swiftCoreFoundationKaTeX parse error: Expected group after ‘_’ at position 102: …ybe you meant: _̲_swift_FORCE_LO…swiftCoreFoundationKaTeX parse error: Expected group after ‘_’ at position 144: …ith: _̲_C.FlutterPlugi…_swiftUIKit”, referenced from:
_swift_FORCE_LOADKaTeX parse error: Expected group after ‘_’ at position 12: _swiftUIKit_̲_kzcity_picker in
libkzcity_picker.a(SwiftKzcityPickerPlugin.o)
(maybe you meant: _swift_FORCE_LOADKaTeX parse error: Expected group after ‘_’ at position 12: _swiftUIKit_̲_kzcity_picker)
“swift_allocObject”, referenced from:
@objc kzcity_picker.SwiftKzcityPickerPlugin.handle(: __C.FlutterMethodCall, result:
(Any?) -> ()) -> () in libkzcity_picker.a(SwiftKzcityPickerPlugin.o)
“static (extension in
Foundation):Swift.String.unconditionallyBridgeFromObjectiveC(__C.NSString?) ->
Swift.String”, referenced from:
kzcity_picker.SwiftKzcityPickerPlugin.handle(: __C.FlutterMethodCall, result:
(Any?) -> ()) -> () in libkzcity_picker.a(SwiftKzcityPickerPlugin.o)
“swift_getInitializedObjCClass”, referenced from:
type metadata accessor for __C.FlutterMethodChannel in
libkzcity_picker.a(SwiftKzcityPickerPlugin.o)
type metadata accessor for kzcity_picker.SwiftKzcityPickerPlugin in
libkzcity_picker.a(SwiftKzcityPickerPlugin.o)
kzcity_picker.SwiftKzcityPickerPlugin.handle(: __C.FlutterMethodCall, result:
(Any?) -> ()) -> () in libkzcity_picker.a(SwiftKzcityPickerPlugin.o)
“_swift_FORCE_LOADKaTeX parse error: Expected group after ‘_’ at position 47: …rom: _̲_swift_FORCE_LO…swiftFoundationKaTeX parse error: Expected group after ‘_’ at position 102: …ybe you meant: _̲_swift_FORCE_LO…swiftFoundationKaTeX parse error: Expected group after ‘_’ at position 24: …picker) “_̲_swift_FORCE_LO…_swiftCoreAudio”, referenced from:
_swift_FORCE_LOADKaTeX parse error: Expected group after ‘_’ at position 16: _swiftCoreAudio_̲_kzcity_picker in
libkzcity_picker.a(SwiftKzcityPickerPlugin.o)
(maybe you meant: _swift_FORCE_LOADKaTeX parse error: Expected group after ‘_’ at position 16: _swiftCoreAudio_̲kzcity_picker)
“static Swift.String.+ infix(Swift.String, Swift.String) -> Swift.String”, referenced
from:
kzcity_picker.SwiftKzcityPickerPlugin.handle(: __C.FlutterMethodCall, result:
(Any?) -> ()) -> () in libkzcity_picker.a(SwiftKzcityPickerPlugin.o)
“_swift_FORCE_LOADKaTeX parse error: Expected group after ‘_’ at position 43: …rom: _̲_swift_FORCE_LO…swiftDarwinKaTeX parse error: Expected group after ‘_’ at position 102: …ybe you meant: _̲_swift_FORCE_LO…swiftDarwinKaTeX parse error: Expected group after ‘_’ at position 151: …ith: _̲_C.FlutterPlugi…_swiftDispatch”, referenced from:
_swift_FORCE_LOADKaTeX parse error: Expected group after ‘_’ at position 15: _swiftDispatch_̲_kzcity_picker in
libkzcity_picker.a(SwiftKzcityPickerPlugin.o)
(maybe you meant: _swift_FORCE_LOADKaTeX parse error: Expected group after ‘_’ at position 15: _swiftDispatch_̲_kzcity_picker)
“swift_release”, referenced from:
kzcity_picker.SwiftKzcityPickerPlugin.handle(: __C.FlutterMethodCall, result:
(Any?) -> ()) -> () in libkzcity_picker.a(SwiftKzcityPickerPlugin.o)
__swift_destroy_boxed_opaque_existential_0 in
libkzcity_picker.a(SwiftKzcityPickerPlugin.o)
@objc kzcity_picker.SwiftKzcityPickerPlugin.handle(: __C.FlutterMethodCall, result:
(Any?) -> ()) -> () in libkzcity_picker.a(SwiftKzcityPickerPlugin.o)
“_swift_deallocObject”, referenced from:
l_objectdestroy in libkzcity_picker.a(SwiftKzcityPickerPlugin.o)
“_swift_FORCE_LOADKaTeX parse error: Expected group after ‘_’ at position 42: …rom: _̲_swift_FORCE_LO…swiftMetalKaTeX parse error: Expected group after ‘_’ at position 102: …ybe you meant: _̲_swift_FORCE_LO…swiftMetalKaTeX parse error: Double subscript at position 115: …ugin.handle(_: _̲_C.FlutterMetho…_swiftObjectiveC”, referenced from:
_swift_FORCE_LOADKaTeX parse error: Expected group after ‘_’ at position 17: …swiftObjectiveC_̲_kzcity_picker in
libkzcity_picker.a(SwiftKzcityPickerPlugin.o)
(maybe you meant: _swift_FORCE_LOADKaTeX parse error: Expected group after ‘_’ at position 17: …swiftObjectiveC_̲_kzcity_picker)
“_swift_unknownObjectRetain”, referenced from:
@objc static kzcity_picker.SwiftKzcityPickerPlugin.register(with:
__C.FlutterPluginRegistrar) -> () in libkzcity_picker.a(SwiftKzcityPickerPlugin.o)
“Swift._bridgeAnythingToObjectiveC(A) -> Swift.AnyObject”, referenced from:
reabstraction thunk helper from @escaping @callee_unowned @convention(block)
(@unowned Swift.AnyObject?) -> () to @escaping @callee_guaranteed (@in_guaranteed
Any?) -> () in libkzcity_picker.a(SwiftKzcityPickerPlugin.o)
“_swift_getObjCClassMetadata”, referenced from:
type metadata accessor for __C.FlutterMethodChannel in
libkzcity_picker.a(SwiftKzcityPickerPlugin.o)
@objc static kzcity_picker.SwiftKzcityPickerPlugin.register(with:
__C.FlutterPluginRegistrar) -> () in libkzcity_picker.a(SwiftKzcityPickerPlugin.o)
“(extension in Foundation):Swift.String._bridgeToObjectiveC() -> __C.NSString”,
referenced from:
@nonobjc __C.FlutterMethodChannel.__allocating_init(name: Swift.String,
binaryMessenger: __C.FlutterBinaryMessenger) -> __C.FlutterMethodChannel in
libkzcity_picker.a(SwiftKzcityPickerPlugin.o)
“_swift_getObjCClassFromMetadata”, referenced from:
@nonobjc __C.FlutterMethodChannel.__allocating_init(name: Swift.String,
binaryMessenger: __C.FlutterBinaryMessenger) -> __C.FlutterMethodChannel in
libkzcity_picker.a(SwiftKzcityPickerPlugin.o)
“_swift_FORCE_LOADKaTeX parse error: Expected group after ‘_’ at position 46: …rom: _̲_swift_FORCE_LO…swiftCoreMediaKaTeX parse error: Expected group after ‘_’ at position 102: …ybe you meant: _̲_swift_FORCE_LO…swiftCoreMedia$kzcity_picker)
“type metadata for Swift.S

Xcode debugging for the real iPhone Error: code signature version is no longer supported

Details

Unable to install "MyApp"
Domain: com.apple.dt.MobileDeviceErrorDomain
Code: -402620375
-

The code signature version is no longer supported.
Domain: com.apple.dt.MobileDeviceErrorDomain
Code: -402620375
User Info: {
  DVTRadarComponentKey = 261622;
  MobileDeviceErrorCode = "(0xE8008029)";
  "com.apple.dtdevicekit.stacktrace" = (
0  DTDeviceKitBase           0x000000011edd83b8 DTDKCreateNSErrorFromAMDErrorCode + 220
1  DTDeviceKitBase           0x000000011ee16ae1 __90-[DTDKMobileDeviceToken installApplicationBundleAtPath:withOptions:andError:withCallback:]_block_invoke + 155
2  DVTFoundation            0x0000000107881b7c DVTInvokeWithStrongOwnership + 71
3  DTDeviceKitBase           0x000000011ee16822 -[DTDKMobileDeviceToken installApplicationBundleAtPath:withOptions:andError:withCallback:] + 1440
4  IDEiOSSupportCore          0x000000011eccf999 __118-[DVTiOSDevice(DVTiPhoneApplicationInstallation) processAppInstallSet:appUninstallSet:installOptions:completionBlock:]_block_invoke.294 + 3534
5  DVTFoundation            0x00000001079b4931 __DVT_CALLING_CLIENT_BLOCK__ + 7
6  DVTFoundation            0x00000001079b655b __DVTDispatchAsync_block_invoke + 1191
7  libdispatch.dylib          0x00007fff20508603 _dispatch_call_block_and_release + 12
8  libdispatch.dylib          0x00007fff205097e6 _dispatch_client_callout + 8
9  libdispatch.dylib          0x00007fff2050f5ca _dispatch_lane_serial_drain + 606
10 libdispatch.dylib          0x00007fff2051008d _dispatch_lane_invoke + 366
11 libdispatch.dylib          0x00007fff20519bed _dispatch_workloop_worker_thread + 811
12 libsystem_pthread.dylib       0x00007fff206b04c0 _pthread_wqthread + 314
13 libsystem_pthread.dylib       0x00007fff206af493 start_wqthread + 15
);
}
-

It may be caused by inconsistent signatures on the framework, such as do not embed , and embed and sign

Possible solutions:
app targets -> General -> Frameworks,Libraries,and EmbeddedContent -> Modify embed and sign to do not embed .

How to Solve pod Error: “Authentication token is invalid or unverified. Either verify it with the email that…”

The following error occurs when executing pod trunk push:

[!] Authentication token is invalid or unverified. Either verify it with the email that was sent or register a new session.

Solution:

1. Execute the command: pod trunk register ‘your mailbox’, ‘XXXXXX’ — description =’xxxx ‘   Re register your account
2. Find and open the verification link in your email
3. Return to the terminal and execute the command again: pod trunk push xxxxx.podspec — allow warnings

Sending ‘const NSString *’ to parameter of type ‘NSString *’ discards qualifiers [Solved]

For example, write const NSString* firstString = @"xxx";
NSString* secondString = @"yyyy";
[secondString isEqualToString:firstString];
There is a warning about sending 'const NSString *' to parameter of type 'NSString *' discards qualifiers.
Workaround.
Change const NSString* firstString = @"xxx";
to NSString* const firstString = @"xxx";

Explanation: The former is equivalent to the pointer itself is not modifiable, the latter indicates that the content pointed to by the pointer is not modifiable, both serve to make firstString readable and unwritable only.

 

Sending ‘const NSString *__strong‘ to parameter of type ‘NSString *‘ discards qualifiers

String value encountered a warning message, record it

Sending 'const NSString *__strong' to parameter of type 'NSString *' discards qualifiers

The code is written like this

UIKIT_EXTERN const NSString * kNetworkType;

This warning will be issued when using it, and it will be changed to:

UIKIT_EXTERN NSString * const kNetworkType;

If const is placed after nsstring *, there will be no warning.