title: Troubleshooting sidebar_position: 11 id: troubleshooting license: | Licensed to the Apache Software Foundation (ASF) under one or more contributor license agreements. See the NOTICE file distributed with this work for additional information regarding copyright ownership. The ASF licenses this file to You under the Apache License, Version 2.0 (the “License”); you may not use this file except in compliance with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
This page covers common Swift issues and how to debug them.
Type not registered: ...Cause: user type was not registered on the current Fory instance.
Fix:
fory.register(MyType.self, id: 100)
Type mismatch: expected ..., got ...Cause: registration mapping or field type info differs across peers.
Fix:
Invalid data: xlang bitmap mismatchCause: serializer and deserializer use different xlang settings.
Fix: configure both sides with matching xlang mode.
Invalid data: class version hash mismatchCause: schema changed while compatible=false.
Fix:
@ForyObject requires explicit types for stored propertiesAdd explicit type annotations to stored properties.
@ForyObject enum associated values cannot have default valuesRemove default values from enum case associated values.
Set<...> with Any elements is not supported by @ForyObject yetUse [Any] or a typed set instead.
Dictionary<..., ...> with Any values is only supported for String, Int32, or AnyHashable keysSwitch key type to String, Int32, or AnyHashable, or avoid dynamic Any map values.
Run Swift tests:
cd swift ENABLE_FORY_DEBUG_OUTPUT=1 swift test
Run Java-driven Swift xlang tests:
cd java/fory-core ENABLE_FORY_DEBUG_OUTPUT=1 FORY_SWIFT_JAVA_CI=1 mvn -T16 test -Dtest=org.apache.fory.xlang.SwiftXlangTest