https://kotlinlang.org logo
#ios
Title
# ios
g

GarouDan

04/10/2019, 12:00 AM
I’m trying to build a mpp project with an iosX64 target but I’m receiving an error like this one:
Copy code
Bundle at path /Users/myUser/Library/Developer/CoreSimulator/Devices/DEVICE_NUMBER/data/Library/Caches/com.apple.mobile.installd.staging/temp.UblNHF/extracted/iosApp.app/Frameworks/main.framework did not have a CFBundleIdentifier in its Info.plist
I did a research about this and they say this is related with a
cocoapods
gem, but I’m not really using something like this, the project, for now, is really simple, just some kind of a hello world. After a lot of attempts I was able to use
iPhone 8
but not
iPhone Xr
(but even with
iPhone 8
it doesn’t work always). Does someone know why this happens? PS.: I’m using
outputKinds("framework")
in my
build.gradle.kts
i

ilya.matveev

04/10/2019, 5:52 AM
Am I missing some configuration on my
build.gradle.kts
?
It doesn't look so. Could you please provide a link to your project? A compilation log would be helpful too. To get it, just run the Gradle build with
-i
flag.
v

Vyacheslav Karpukhin [JB]

04/10/2019, 9:20 AM
Could you show us the entire Info.plist, please?
g

GarouDan

04/10/2019, 11:41 PM
Hi @ilya.matveev and @Vyacheslav Karpukhin [JB], thanks in advance for your time. I was able to confirm that this is happening after I’ve upgraded my XCode version to the latest one (
10.2 (10E125)
). For example, this project of mine was working ok but now it is giving the same error: https://github.com/Danilo-Araujo-Silva/kotlin-multiplatform-android-ios-example and as you can see in this issue https://youtrack.jetbrains.com/issue/KT-29804 I’ve shared this repository to show a working solution for the problem that I’ve found. In the beginning I was thinking the problem was related with the new project that I’m working on, but now it seems to be happening in general.
Here is a photo of my
Info.plist
inside of my
main.framework
. My build is passing ok and all steps of the build process is working, it is only failing when I’m trying to reach the simulator
The compilation log with the parameter
-i
is this one:
Should I create an issue for this?
v

Vyacheslav Karpukhin [JB]

04/11/2019, 10:00 AM
If only to Apple 🙂 The problem here is that starting from version 10.2 Xcode replaces the Info.plist with a dummy one during the copying/codesigning phases. You can add a proper Info.plist to your Xcode project, and this should solve the problem. For an example you can take a look at the project generated by the K/N plugin for AppCode.
g

GarouDan

04/11/2019, 5:57 PM
Hum, I see. Can you share with me the link of this plugin? I took a photo about the Info.plist configuration because the file was in a binary mode, can this affect me somehow?
v

Vyacheslav Karpukhin [JB]

04/11/2019, 9:30 PM
No, binary format is fine. The plugin is available in the repository: https://plugins.jetbrains.com/plugin/10619-kotlin-native-for-appcode
g

GarouDan

04/11/2019, 9:48 PM
Can I use this plugin with IntelliJ Ultimate? Or it is only compatible with AppCode? If is not compatible, do you have another repository, maybe something on github, that shows how could I do that?
v

Vyacheslav Karpukhin [JB]

04/11/2019, 10:02 PM
Here is a project that was generated from a template.
g

GarouDan

04/11/2019, 10:28 PM
Thanks a lot I’ll take a look 😃
@Vyacheslav Karpukhin [JB], this project that you gave is working fine. Thanks 😃 In the other hand, I’m trying to use a Swift project created by AppCode but I’m receiving the following error:
Copy code
No such module 'KotlinNativeFramework'
Do you have any idea what could cause this? This error occurs when trying to compile the Swift files
s

svyatoslav.scherbina

04/15/2019, 8:22 AM
@sunbreak could you provide more details on “New #multiplatform project in IDEA(2019.1)“? It works for me.
v

Vyacheslav Karpukhin [JB]

04/15/2019, 8:55 AM
@GarouDan @sunbreak Please make sure that you click on the "Import Gradle Project" notification when opening the project in AppCode.
s

sunbreak

04/15/2019, 9:22 AM
@svyatoslav.scherbina
Copy code
IntelliJ IDEA 2019.1 (Ultimate Edition)
Build #IU-191.6183.87, built on March 27, 2019
Licensed to Sunbreak Wang
Subscription is active until May 29, 2019
For educational use only.
JRE: 1.8.0_202-release-1483-b39 x86_64
JVM: OpenJDK 64-Bit Server VM by JetBrains s.r.o
macOS 10.14.3
Copy code
kotlin plugin v1.3.30-release-IJ2019.1-1
Copy code
XCode 10.2 (10E25)
- Create a “kotlin-mpp-test” project with IDEA via “Kotlin (Mobile Android/iOS)“. - Set the “sdk.dir” in the “local.properties” in the root and init “gradlew” with “gradle wrapper --gradle-version 4.7 --distribution-type all”. - Open iosApp/iosApp.xcodeproj with Xcode - Run target “iosApp” on “iPhone XR”
s

svyatoslav.scherbina

04/15/2019, 10:39 AM
@sunbreak Thank you, confirmed.
s

sunbreak

04/15/2019, 10:46 AM
@svyatoslav.scherbina is there any work around before fix?
s

svyatoslav.scherbina

04/15/2019, 10:58 AM
Yes. 1. Add
Info.plist
to your
app
directory with contents like this:
Copy code
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "<http://www.apple.com/DTDs/PropertyList-1.0.dtd>">
<plist version="1.0">
<dict>
    <key>CFBundleDevelopmentRegion</key>
    <string>$(DEVELOPMENT_LANGUAGE)</string>
    <key>CFBundleExecutable</key>
    <string>$(EXECUTABLE_NAME)</string>
    <key>CFBundleIdentifier</key>
    <string>$(PRODUCT_BUNDLE_IDENTIFIER)</string>
    <key>CFBundleInfoDictionaryVersion</key>
    <string>6.0</string>
    <key>CFBundleName</key>
    <string>$(PRODUCT_NAME)</string>
    <key>CFBundlePackageType</key>
    <string>FMWK</string>
    <key>CFBundleShortVersionString</key>
    <string>1.0</string>
    <key>CFBundleVersion</key>
    <string>$(CURRENT_PROJECT_VERSION)</string>
</dict>
</plist>
2. Select
iosApp
on the left pane in Xcode, then select
app
under “TARGETS”, switch to “Build Settings” tab, look for “Packinging” section under it. Locate “Info.plist file”, it should have empty value. Change it to
$(SRCROOT)/../app/Info.plist
.
s

sunbreak

04/15/2019, 3:43 PM
@svyatoslav.scherbina Thanks a lot👍
@Vyacheslav Karpukhin [JB] I retry several times and am unable to reproduce the Kotlin/Native problem. Thank you all the same😀
8 Views