Hello! I wanna try to use Periphery (<https://gith...
# multiplatform
v
Hello! I wanna try to use Periphery (https://github.com/peripheryapp/periphery) static code analyzer in my iOS project, but I get error using Periphery script via the terminal:
Undefined symbols for architecture arm64:
"_OBJC_CLASS_$_IosCombinedDialogModelAlign", referenced from:
objc-class-ref in StringExtensions.o
"_OBJC_CLASS_$...
...
ld: symbol(s) not found for architecture arm64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
What I need to do?
Also in XCode 11.4 when I'm building for real iPhone I get this type of error:
Building for iOS, but the linked framework was built for iOS Simulator.
a
Hello! Can you tell a bit more on your project structure? Seems like K/N framework built for a device is not abvailable in your project. Sharing the Gradle script can also help a bit.
v
So, I fixed first issue:
Copy code
final def iOSTarget = System.getenv('SDK_NAME')?.startsWith("iphoneos")  \ ? presets.iosArm64 : presets.iosX64
I changed my app scheme from Debug to Release and by that I changed preset too. And it works fine now.
Copy code
kotlin {
    final def iOSTarget = System.getenv('SDK_NAME')?.startsWith("iphoneos")    \
                                 ? presets.iosArm64 : presets.iosX64

    targets { ... }
}
Copy code
task packForXCode(type: Sync) {
    final File frameworkDir = new File(rootProject.buildDir, "xcode-frameworks")
    final String mode = project.findProperty("XCODE_CONFIGURATION")?.toUpperCase() ?: 'DEBUG'
    final def framework = kotlin.targets.iOS.binaries.getFramework("IosCombined", mode)

    inputs.property "mode", mode
    dependsOn framework.linkTask

    from { framework.outputFile.parentFile }
    into frameworkDir

    doLast {
        new File(frameworkDir, 'gradlew').with {
            text = "#!/bin/bash\nexport 'JAVA_HOME=${System.getProperty("java.home")}'\ncd '${rootProject.rootDir}'\n./gradlew \$@\n"
            setExecutable(true)
        }
    }
}
Do you mean this gradle script?
About
Building for iOS, but the linked framework was built for iOS Simulator.
I reinstalled XCode 11.4 (I also have XCode 11.3) and this issue has disappeared for me. Don't know what's the really problem is. Maybe some bug in XCode