-
-
Notifications
You must be signed in to change notification settings - Fork 32
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Errors in main.mm file : Use of undeclared identifier #12
Comments
In your screenshot, there are two Data directories listed under Unity group. There should only be one Data directory there. Guess you dragged Data instead of Classes by mistake. |
Thank you @yasirkula !!! |
Can you show the contents of the Unity group in Xcode? |
If you are trying to test the app on a simulator, can you also try to test it on a real device and see if it changes anything? Unity produces slightly different output for simulators (see Target SDK/SDK Version), so it might be the issue here. Otherwise, if you have made all the adjustments to both PROJECT and TARGETS in Build Settings correctly, I couldn't spot the issue at first glance. |
Unfortunately, the error doesn't go away when I try to test it on a real device. :( |
If you are sure that you have set all the configurations to unityconfig and that you have set the value of UNITY_IOS_EXPORTED_PATH to the path of your Unity build directory (not the one in the screenshot) for both PROJECT and TARGETS, then I guess any help is welcome at this point. |
Can you show the contents of /Users/Scarffy/Desktop/iOSNativeApp, as well? Just to be sure, if it is OK. |
Thank you for providing all the info. Looking at the screenshots, everything does seem to be in order; and I currently have no clues to fix this error. |
That's a bummer. Thanks for trying to solve this issue. |
At first I also get this kind of error and I am not sure how I solved this but try again the whole thing again. I also change the unityconfig.xconfig UNITY_RUNTIME_VERSION to the version I used but I don't think this is the problem. Maybe you missed something somewhere. When I tried to make it work it took me around 4 day to figure everything out. :D I also wrote a php script for changing the files after export which makes these steps a little bit faster. I will post this script today and you can try with that if you want. |
I made the repo and a how-to for the script. Feel free to ask if you need more help with it. |
@yasirkula Sorry if I request too much but can you do a video tutorial on this project? edit : added screenshot |
A video tutorial sounds nice but neither my current setup nor my motivation is ready for it :/ Sorry. |
@scarffy Yes it can cause the problem. When you click on the prefix header and press DELETE it changes the path to the unity folder. And you need to do this in the TARGET and in the PROJECT |
I didn't see the edit while commenting, sorry. Thanks @mateenagy for the assist :) |
@yasirkula No problem :) Yasir using xcode 8.3.3 while I'm using xcode 9.3.1 |
If your Unity build path is /Users/Scarffy/Desktop/iOSNativeApp, then both of them should point to /Users/Scarffy/Desktop/iOSNativeApp/Classes/Prefix.pch. When you select them and press Delete, their values should automatically revert to it. |
No I also use Xcode 9.3.1 with Unity 2017.1 and 2018 and everything works well. I also use with the newest Vuforia(only Vuforia or camera usage can be cause problem in Xcode 9.3, but not like this). But yasirkula is right, both of the Prefix Header path should be the same if you delete them. |
I had the same issue. When I press delete, the Prefix Header just becomes blank (it doesn't change to the unity folder). I'm using Xcode 9.3 and Unity 2017.3. |
It shouldn't make any different if I don't use vuforia right? |
@scarffy There is no difference. Did you set the prefix header for both TARGET and PROJECT? |
Yes I did. I'll try with blank project for both ionic and unity. I'll let you know how it goes |
Hi Guys, I think I run out of luck with this plugin. I'm not sure where I went wrong, I just can't make it work. |
Did it work on a blank project, though? |
@scarffy Can you upload the blank project you made to github so I or we can check your code? |
@yasirkula @mateenagy @jbgtmartin Happy news guys! I managed to make it work. From the bottom of my heart, I truly thank you for the help you guys give me. I missed out @jbgtmartin comment. My prefix header for TARGET is already right but not for PROJECT. After I build, I ran to this error #15 which is easily solved. |
Glad to hear it! |
Hello,
thank you for this tutorial. Followed all the steps, but in the main.mm file i have the following
errors: (screen the image bellow)
Sorry for the image quality
This is the file content:
`#include "RegisterMonoModules.h"
#include "RegisterFeatures.h"
#include
// Hack to work around iOS SDK 4.3 linker problem
// we need at least one __TEXT, __const section entry in main application .o files
// to get this section emitted at right time and so avoid LC_ENCRYPTION_INFO size miscalculation
static const int constsection = 0;
void UnityInitTrampoline();
// WARNING: this MUST be c decl (NSString ctor will be called after +load, so we cant really change its value)
const char* AppControllerClassName = "AppDelegate";
int main(int argc, char* argv[])
{
@autoreleasepool
{
UnityInitTrampoline();
UnityParseCommandLine(argc, argv);
}
#if TARGET_IPHONE_SIMULATOR && TARGET_TVOS_SIMULATOR
#include <pthread.h>
extern "C" int pthread_cond_init$UNIX2003(pthread_cond_t *cond, const pthread_condattr_t *attr)
{ return pthread_cond_init(cond, attr); }
extern "C" int pthread_cond_destroy$UNIX2003(pthread_cond_t *cond)
{ return pthread_cond_destroy(cond); }
extern "C" int pthread_cond_wait$UNIX2003(pthread_cond_t *cond, pthread_mutex_t *mutex)
{ return pthread_cond_wait(cond, mutex); }
extern "C" int pthread_cond_timedwait$UNIX2003(pthread_cond_t *cond, pthread_mutex_t *mutex,
const struct timespec *abstime)
{ return pthread_cond_timedwait(cond, mutex, abstime); }
#endif // TARGET_IPHONE_SIMULATOR && TARGET_TVOS_SIMULATOR
`
The text was updated successfully, but these errors were encountered: