ios - How to compile java code with swift in XCode -


i use j2objc xcode build rules in xcode(swift).

  1. write java file(people.java) 2.make settings build rules, , add custom script following:

    "${j2objc_home}/j2objc" -d ${derived_files_dir} -sourcepath "${project_dir}/iosapp-swift" --no-package-directories -use-arc ${input_file_path};

note: enable arc

  1. add bridging-header file , import people.h file.
  2. call function people class in viewcontroller file.

when build project ,failed:'people.h not found'.

and when build before importing , using people.h, implement import people.h file , calling function people class in viewcontroller file, , build project. works.

i think problem caused j2objc not convert java file .h/.m file before build bridging-header file. knows how fix it?

thanks

you'll want add people.java xcode target's "compile sources" build phase. when phase run, compile each file using either built-in rules objective c files, or custom build rule java files.


Comments

Popular posts from this blog

PySide and Qt Properties: Connecting signals from Python to QML -

c# - DevExpress.Wpf.Grid.InfiniteGridSizeException was unhandled -

scala - 'wrong top statement declaration' when using slick in IntelliJ -