I use J2Objc by Xcode build rules in Xcode(swift).
Write a java file(People.java) 2.make settings for build rules, and add the custom script as the following:
"${J2OBJC_HOME}/j2objc" -d ${DERIVED_FILES_DIR} -sourcepath "${PROJECT_DIR}/iOSApp-Swift" --no-package-directories -use-arc ${INPUT_FILE_PATH};
Note: i enable the ARC
- add the bridging-header file and import People.h file.
- call some function from People class in viewcontroller file.
When I build the project ,failed:'People.h not found'.
And When i build before importing and using the People.h, then implement to import People.h file and calling some function from People class in viewcontroller file, and build the project. It works.
I think the problem caused by J2objc not convert java file to .h/.m file before build the bridging-header file. Who knows how to fix it?
Thanks
You'll want to add People.java to your Xcode target's "Compile Sources" build phase. When that phase run, it will compile each file using either built-in rules for Objective C files, or your custom build rule for Java files.