ios - How to compile java code with swift in XCode -
i use j2objc xcode build rules in xcode(swift).
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
- add bridging-header file , import people.h file.
- 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
Post a Comment