App crashes with Google Map Tiles on iOS16

So here is the quick version:
I created a new mobile-compatible game using the First Person template from Epic.
Set up a new “Maps Level” following these instructions https://cesium.com/learn/unreal/unreal-photorealistic-3d-tiles
Add in apple developer certificates and provisions and such
Build the iOS app.
Installed the iOS app on my iPad (iOS16)
run the app the first time and everything works great!
run the app the next time and i get a brief glimpse of the sky before the app crashes.
run the app the next N-times and get the same result, near instant crash.

This is on iOS16. If i run the app on iOS17 then it does not crash
If I use Bing Maps then it does not crash.
Unreal 5.2
Cesium for UE plugin 2.2.0

I set this up in the first person template to prove that it wasn’t a problem with the app that i built at the end of last year. I tested my app using iOS16 and it all worked perfectly fine. then I’d sorta put the Cesium/Maps part to the side as i focused on something else. Then about a week ago I got a report of the Maps part not working. and i go a look and my app crashes when loading the maps. So what I’m saying is between early-December and now something in the Google Map Tiles seems to have changed that is causing this crash.

any ideas?
thx-e

That’s pretty mysterious. Can you get a call stack of the crash from the device? Or the Unreal log more generally?

Here are the Unreal logs and the Xcode device logs from the first run where it works and the subsequent runs, where it does not work.

Also to note. If you completely shutdown the iPad and restart it then it “resets” and you can run the app again the 1st time successfully. But then on subsequent runs it crashes.
Also, you can “reset” it by copying the .ipa app file onto the iPad again.

thx-e
Cesium iOS Logs.zip (291.0 KB)

I see this in the log:

default	13:08:03.341742+0000	ReportCrash	ASI found [libsystem_malloc.dylib] (sensitive) 'firstPerson(2953,0x16c3bb000) malloc: *** error for object 0x127244140: pointer being freed was not allocated
'
default	13:08:04.492816+0000	ReportCrash	Formulating fatal 309 report for corpse[2953] firstPerson
default	13:08:04.495369+0000	ReportCrash	loadStoreInfo [platform 2] com.ttfdev.artollkitapp from file:///private/var/containers/Bundle/Application/AB95D49F-D4D4-4DBF-A75E-C80FFC76320D/firstPerson.app/
default	13:08:04.497636+0000	osanalyticshelper	creating type 309 as /private/var/mobile/Library/Logs/CrashReporter/.firstPerson-2024-01-18-130804.ips
default	13:08:04.505446+0000	osanalyticshelper	Saved type '309(<private>)' report (7 of max 25) at /private/var/mobile/Library/Logs/CrashReporter/firstPerson-2024-01-18-130804.ips

I don’t know what the means, but there might be more information in that /private/var/mobile/Library/Logs/CrashReporter/firstPerson-2024-01-18-130804.ips file it mentions. If you can get XCode to stop on the crash, and get a call stack, that should shed a lot of light on it, too.

Thanks.
i got the log file. I took a look and it doesn’t look to my untrained eye that there is anything useful in there.

but I don’t think I can get a stack trace because my project is not in Xcode.

firstPerson-2024-02-02-105918.zip (7.5 KB)

thx-e

I solved it!
I just saw this post:
https://community.cesium.com/t/solved-ios-apps-distributed-to-the-app-store-crash/29401

and reading that and looking at my device output and it looked like a similar pointer issue.
https://alyamkin.artstation.com/blog/9VEQ/ue4-ios-and-pointer-being-freed-was-not-allocated
So i just did the fix from that post and it worked like a charm!

thx-e

Hi @Kevin_Ring or @Eric_Carney Can you guys let me know if you were able to fix it as, I tried following the directions in the Solved Ios Apps Distributed to the app store link

but the problem is the packaging fails as it says it’s not the right architecture

If you guys exactly know how to fix this problem, can you please provide me with steps to resolve it

Its greatly appreciated,

thanks

Ouch, that was a long while ago.

Good news is that we did solve the issue and our app is working great with Cesium and iOS 16

Bad news is that we solved it so long ago that I don’t remember what the fix was.

I’ll have a look back at my dev notes and perforce submits and maybe that’ll shed some light on what we did. But I can’t promise anything.

Eric
In transit…

do you mean it worked properly with photorealistic Google Tiles?

Does Bing Maps with Cesium Terrain Work Fine without Making any Changes to Source Files?

I have not tried that yet, but in your experience do you think we can get away with using that and prevent the crash of packaged iOS app for distribution?

on a side note,

if you made changes to source File Please Provide the Exact Code that did that magic @Eric_Carney

thanks for a prompt reply to this!

We only use Google Tiles with Cesium in our iOS app.

On thing to note is that this issue only affected me on iOS16. My app worked on 17 just fine. If you are seeing the same thing then this is likely the same issue.

I just re-read the posts on this thread. and I now remember how I solved this.
My answer is, as mentioned in this thread…
https://community.cesium.com/t/solved-ios-apps-distributed-to-the-app-store-crash/29401
this link has more info on it
https://alyamkin.artstation.com/blog/9VEQ/ue4-ios-and-pointer-being-freed-was-not-allocated

This needs to go into your PROJECTNAME/Source directory in the PROJECTNAME.Target.cs file. You might not have this file if you have a Blueprint-only project. Then you’d have to Google how to convert your Blueprint project to a C++ project, which I think is pretty simple.

any way pop the code into your Target file and it works.

        // Force ANSI allocator for game client
        if(Target.Platform == UnrealTargetPlatform.IOS)
        {
            GlobalDefinitions.Add("FORCE_ANSI_ALLOCATOR=1");
        }

Unfortunately, I don’t know what your error about not being the right architecture means.

i hope that helps.

-e

I’ve been doing some testing and it looks like this fix prevents me from building an app in UE5.3. Previous i was working in 5.2 which worked. But I’m now testing 5.3 and created a new first person game from the template and added this in to the target file and when i go to Package for iOS it errors.
It says something about: Undefined symbols for architecture arm64 in Module.AnimGraphRuntime.cpp. I’m guessing something in that file doesn’t like this.

error log below
This is without the Cesium Plugin even installed. UE5.3 just won’t Package with this command in the Target file.
I’ll do some more testing, but at this point in time i can’t get Cesium to run in UE5.3

-e

Xcode 15.2.0
MacOS 13.7 (M1)
UE 5.3.2

UATHelper: Packaging (IOS): ------ Building 21 action(s) started ------
UATHelper: Packaging (IOS): [1/21] Compile [arm64] SharedPCH.Core.Cpp20.h
UATHelper: Packaging (IOS): [2/21] Compile [arm64] SharedPCH.CoreUObject.Cpp20.h
UATHelper: Packaging (IOS): [3/21] Compile [arm64] SharedPCH.Slate.Cpp20.h
UATHelper: Packaging (IOS): [4/21] Compile [arm64] SharedPCH.Engine.Cpp20.h
UATHelper: Packaging (IOS): [5/21] Compile [arm64] firstPerson5p3PlayerController.gen.cpp
UATHelper: Packaging (IOS): [6/21] Compile [arm64] firstPerson5p3GameMode.cpp
UATHelper: Packaging (IOS): [7/21] Compile [arm64] firstPerson5p3Projectile.gen.cpp
UATHelper: Packaging (IOS): [8/21] Compile [arm64] firstPerson5p3.cpp
UATHelper: Packaging (IOS): [9/21] Compile [arm64] firstPerson5p3Character.gen.cpp
UATHelper: Packaging (IOS): [10/21] Compile [arm64] TP_WeaponComponent.gen.cpp
UATHelper: Packaging (IOS): [11/21] Compile [arm64] TP_PickUpComponent.gen.cpp
UATHelper: Packaging (IOS): [12/21] Compile [arm64] firstPerson5p3Character.cpp
UATHelper: Packaging (IOS): [13/21] Compile [arm64] firstPerson5p3.init.gen.cpp
UATHelper: Packaging (IOS): [14/21] Compile [arm64] firstPerson5p3Projectile.cpp
UATHelper: Packaging (IOS): [15/21] Compile [arm64] firstPerson5p3GameMode.gen.cpp
UATHelper: Packaging (IOS): [16/21] Compile [arm64] firstPerson5p3PlayerController.cpp
UATHelper: Packaging (IOS): [17/21] Compile [arm64] TP_PickUpComponent.cpp
UATHelper: Packaging (IOS): [18/21] Compile [arm64] TP_WeaponComponent.cpp
UATHelper: Packaging (IOS): [19/21] sh /Volumes/MiniExt/UE_Projects/firstPerson5p3/Binaries/IOS/firstPerson5p3-IOS-Shipping
UATHelper: Packaging (IOS): Undefined symbols for architecture arm64:
UATHelper: Packaging (IOS): “StdFree(void*)”, referenced from:
UATHelper: Packaging (IOS): FRBFInterpolatorBase::SetUpperKernel(TArrayView<float, int> const&, int) in Module.AnimGraphRuntime.cpp.o
UATHelper: Packaging (IOS): Eigen::PartialPivLU<Eigen::Matrix<float, -1, -1, 0, -1, -1>>::PartialPivLU<Eigen::Matrix<float, -1, -1, 0, -1, -1>>(Eigen::EigenBase<Eigen::Matrix<float, -1, -1, 0, -1, -1>> const&) in Module.AnimGraphRuntime.cpp.o
UATHelper: Packaging (IOS): Eigen::PartialPivLU<Eigen::Matrix<float, -1, -1, 0, -1, -1>>::compute() in Module.AnimGraphRuntime.cpp.o
UATHelper: Packaging (IOS): Eigen::internal::partial_lu_impl<float, 0, int, -1>::blocked_lu(long, long, float*, long, int*, int&, long) in Module.AnimGraphRuntime.cpp.o
UATHelper: Packaging (IOS): Eigen::internal::triangular_solve_matrix<float, long, 1, 5, false, 0, 0, 1>::run(long, long, float const*, long, float*, long, long, Eigen::internal::level3_blocking<float, float>&) in Module.AnimGraphRuntime.cpp.o
UATHelper: Packaging (IOS): void Eigen::internal::generic_product_impl<Eigen::Ref<Eigen::Matrix<float, -1, -1, 0, -1, -1>, 0, Eigen::OuterStride<-1>>, Eigen::Ref<Eigen::Matrix<float, -1, -1, 0, -1, -1>, 0, Eigen::OuterStride<-1>>, Eigen::DenseShape, Eigen::DenseShape, 8>::scaleAndAddTo<Eigen::Ref<Eigen::Matrix<float, -1, -1, 0, -1, -1>, 0, Eigen::OuterStride<-1>>>(Eigen::Ref<Eigen::Matrix<float, -1, -1, 0, -1, -1>, 0, Eigen::OuterStride<-1>>&, Eigen::Ref<Eigen::Matrix<float, -1, -1, 0, -1, -1>, 0, Eigen::OuterStride<-1>> const&, Eigen::Ref<Eigen::Matrix<float, -1, -1, 0, -1, -1>, 0, Eige
n::OuterStride<-1>> const&, float const&) in Module.AnimGraphRuntime.cpp.o
UATHelper: Packaging (IOS): void Eigen::internal::gemv_dense_selector<2, 1, true>::run<Eigen::Transpose<Eigen::Ref<Eigen::Matrix<float, -1, -1, 0, -1, -1>, 0, Eigen::OuterStride<-1>> const>, Eigen::Transpose<Eigen::Block<Eigen::Ref<Eigen::Matrix<float, -1, -1, 0, -1, -1>, 0, Eigen::OuterStride<-1>> const, 1, -1, false> const>, Eigen::Transpose<Eigen::Block<Eigen::Ref<Eigen::Matrix<float, -1, -1, 0, -1, -1>, 0, Eigen::OuterStride<-1>>, 1, -1, false>>>(Eigen::Transpose<Eigen::Ref<Eigen::Matrix<float, -1, -1, 0, -1, -1>, 0, Eigen::OuterStride<-1>> const> const&, Eigen::Transpose<Eigen::Bloc
k<Eigen::Ref<Eigen::Matrix<float, -1, -1, 0, -1, -1>, 0, Eigen::OuterStride<-1>> const, 1, -1, false> const> const&, Eigen::Transpose<Eigen::Block<Eigen::Ref<Eigen::Matrix<float, -1, -1, 0, -1, -1>, 0, Eigen::OuterStride<-1>>, 1, -1, false>>&, Eigen::Transpose<Eigen::Block<Eigen::Ref<Eigen::Matrix<float, -1, -1, 0, -1, -1>, 0, Eigen::OuterStride<-1>>, 1, -1, false>>::Scalar const&) in Module.AnimGraphRuntime.cpp.o
UATHelper: Packaging (IOS): …
UATHelper: Packaging (IOS): “StdMalloc(unsigned long, unsigned long)”, referenced from:
UATHelper: Packaging (IOS): FRBFInterpolatorBase::SetUpperKernel(TArrayView<float, int> const&, int) in Module.AnimGraphRuntime.cpp.o
UATHelper: Packaging (IOS): Eigen::PartialPivLU<Eigen::Matrix<float, -1, -1, 0, -1, -1>>::PartialPivLU<Eigen::Matrix<float, -1, -1, 0, -1, -1>>(Eigen::EigenBase<Eigen::Matrix<float, -1, -1, 0, -1, -1>> const&) in Module.AnimGraphRuntime.cpp.o
UATHelper: Packaging (IOS): Eigen::PartialPivLU<Eigen::Matrix<float, -1, -1, 0, -1, -1>>::compute() in Module.AnimGraphRuntime.cpp.o
UATHelper: Packaging (IOS): Eigen::internal::triangular_solve_matrix<float, long, 1, 5, false, 0, 0, 1>::run(long, long, float const*, long, float*, long, long, Eigen::internal::level3_blocking<float, float>&) in Module.AnimGraphRuntime.cpp.o
UATHelper: Packaging (IOS): void Eigen::internal::gemv_dense_selector<2, 1, true>::run<Eigen::Transpose<Eigen::Ref<Eigen::Matrix<float, -1, -1, 0, -1, -1>, 0, Eigen::OuterStride<-1>> const>, Eigen::Transpose<Eigen::Block<Eigen::Ref<Eigen::Matrix<float, -1, -1, 0, -1, -1>, 0, Eigen::OuterStride<-1>> const, 1, -1, false> const>, Eigen::Transpose<Eigen::Block<Eigen::Ref<Eigen::Matrix<float, -1, -1, 0, -1, -1>, 0, Eigen::OuterStride<-1>>, 1, -1, false>>>(Eigen::Transpose<Eigen::Ref<Eigen::Matrix<float, -1, -1, 0, -1, -1>, 0, Eigen::OuterStride<-1>> const> const&, Eigen::Transpose<Eigen::Bloc
k<Eigen::Ref<Eigen::Matrix<float, -1, -1, 0, -1, -1>, 0, Eigen::OuterStride<-1>> const, 1, -1, false> const> const&, Eigen::Transpose<Eigen::Block<Eigen::Ref<Eigen::Matrix<float, -1, -1, 0, -1, -1>, 0, Eigen::OuterStride<-1>>, 1, -1, false>>&, Eigen::Transpose<Eigen::Block<Eigen::Ref<Eigen::Matrix<float, -1, -1, 0, -1, -1>, 0, Eigen::OuterStride<-1>>, 1, -1, false>>::Scalar const&) in Module.AnimGraphRuntime.cpp.o
UATHelper: Packaging (IOS): Eigen::internal::general_matrix_matrix_product<long, float, 0, false, float, 0, false, 0, 1>::run(long, long, long, float const*, long, float const*, long, float*, long, long, float, Eigen::internal::level3_blocking<float, float>&, Eigen::internal::GemmParallelInfo*) in Module.AnimGraphRuntime.cpp.o
UATHelper: Packaging (IOS): Eigen::PartialPivLU<Eigen::Matrix<float, -1, -1, 0, -1, -1>>::PartialPivLU(Eigen::PartialPivLU<Eigen::Matrix<float, -1, -1, 0, -1, -1>> const&) in Module.AnimGraphRuntime.cpp.o
UATHelper: Packaging (IOS): …
UATHelper: Packaging (IOS): ld: symbol(s) not found for architecture arm64
UATHelper: Packaging (IOS): clang: error: linker command failed with exit code 1 (use -v to see invocation)
UATHelper: Packaging (IOS): Total time in Parallel executor: 71.05 seconds
PackagingResults: Error: linker command failed with exit code 1 (use -v to see invocation)
UATHelper: Packaging (IOS): Total execution time: 85.65 seconds
UATHelper: Packaging (IOS): Took 85.95s to run dotnet, ExitCode=6
UATHelper: Packaging (IOS): UnrealBuildTool failed. See log for more details. (/Users/ericcarney/Library/Logs/Unreal Engine/LocalBuildLogs/UBT-firstPerson5p3-IOS-Shipping.txt)
UATHelper: Packaging (IOS): AutomationTool executed for 0h 1m 33s
UATHelper: Packaging (IOS): AutomationTool exiting with ExitCode=6 (6)
UATHelper: Packaging (IOS): RunUAT ERROR: AutomationTool was unable to run successfully. Exited with code: 6
PackagingResults: Error: AutomationTool was unable to run successfully. Exited with code: 6
PackagingResults: Error: Unknown Error