How to debug iOS linking / framework embedding issues in KMM projects? - ios

I'm new to KMM but I really wanna get into it. It is obvious that I will make a lot of mistakes during my journey. What makes me a little bit frustrated is, that I'm not able to translate given errors to the reason why it happen. I'm working on a M1 Mac mini.
It would be awesome if someone could show me how he / she would investigate the following issue:
Issue
Does anyone know what causes an error if I try to build iOS:
Task
> Task :shared:compileKotlinIosSimulatorArm64 UP-TO-DATE
./gradlew :shared:embedAndSignAppleFrameworkForXcode
Log
/Users/.../iosApp/ld:1:1: object file (/var/folders/yt/4pjlxzfn48n28yxvdsnrw6n40000gn/T/included3352453535999755831/libparticles.a(libparticles.SkParticleBinding.o))
was built for newer iOS Simulator version (15.2) than being linked (9.0)
I'm using the "Regular framework" approach.
What I already did
Checked the project of "9 occurrences because of the mentioning of iOS 9
I checked my versions, but maybe I have a Version mismatch somewhere in my Kolin code?
I created it freshly new
Gist
Full stacktrace:
https://gist.github.com/tscholze/6d67bc21a2b8e1bdc575e6b80ca8af2b

Related

Xamarin building_problem after update to IOS 11

I have updated my system to IOS 11. Visualstidio for Windows with all newest xamarin updates, Mac os Sierra is up to date and Xcode is the newest Version.
My Problem:
If I want to debugging on the simulator, the following error occurs:
Error error HE0046: Failed to install the app 'ch.ABC' on the device 'iOS 11.0 (15A372) - iPhone 6 Plus': lstat of /Users/administrator/Library/Caches/Xamarin/mtbs/builds/ABC/a3481f272dab3f68e6e828203695f442/bin/iPhoneSimulator/Debug/ABC.app failed: No such file or directory
The ABC.app exist in this path on Mac.
Buildlog:
System.IO.FileNotFoundException: The file '/Users/administrator/Library/Caches/Xamarin/mtbs/builds/ABC/a3481f272dab3f68e6e828203695f442/obj/iPhoneSimulator/Debug/build-signature/signature' was not found on the Mac
File name: '/Users/administrator/Library/Caches/Xamarin/mtbs/builds/ABC/a3481f272dab3f68e6e828203695f442/obj/iPhoneSimulator/Debug/build-signature/signature'
at Xamarin.Messaging.Ssh.MessagingFileManager.d__11.MoveNext() in C:\d\lanes\5126\bd7e3753\source\xamarinvs\src\Messaging\Xamarin.Messaging.Ssh\MessagingFileManager.cs:line 171
this signaturefile is also on the right path.
My attempts to fix the error:
-Clean & rebuild has no effect.
-Delete the bin and obj Folder has no effect.
-I made the provisioning completely new has no effect.
-New projects work.
-This project work wehn i build it in Visual studio for mac
Has anyone an idea what could be the problem here?
thanks
Andreas
Edit:
I think that it is a general Xamarin problem. Old projects (before IOS11) can not run after update to IOS 11 in the simulator.
So, I decided to do the whole exercise of step by step mutating a newly created project (which deploys fine to the iOS 11 simulator) into my project (which does not) by using Beyond Compare to change file by file until no difference remains.
That took a good four hours (big project). All of that was to no avail however. :)
Because it turns out that what made the difference in the end was removing the iOS project from the solution and then adding it back (using the "add existing project" command).
This changes three things in the solution file:
Updates it to the latest VS solution format version.
Moves the iOS project to the bottom in a few places.
Fixes up some weird build configuration and/or platform configuration inconsistencies.
Naturally, I thought the last one would be the trick, so I tried only applying that delta in isolation, but that actually didn't fix the issue! I don't fully understand why, but actually performing the action of removing and re-adding the project does.
Very curious to see whether this works for others.

Xcode 8.3 Indexing & Building Extremely Slow

I am posting this after reading many similar posts on here regarding this issue and none of the solutions that worked for other people not working...
Xcode Version 8.3.3 (8E3004b)
Swift 3.1
Things I tried
Deleting Derived Data folder
Deleting Workspace File
Cleaning Build Folder
Cleaning Build
Reinstalled Xcode (after complete removal)
I also looked for Swift Issues:
Removed all concatenating strings
Cleaned up Swift arrays and dictionaries
Added Whole module optimizations
This all started happening after last Xcode update of 8.3.3. My project was compiling within seconds and now I have to wait at least 15 mins for it to index, then 5 minutes to compile after everything I change even something small in code.
When Building, it get stuck in "Compiling Swift source files". Is there way for me to look in to where it is actually getting stuck?
BIG UPDATE
I tried pretty much everything. Read every article, post, ect. NOTHING worked. My project was created right after 10.0.
Solution
Creating a new project and copying each file worked! It used to take 8-9 minuted to build. Now less than 2 seconds!
Apple knows about this problem, and says that Xcode 9 beta will perform much better. Note that if you don't want to update to Swift 4, you can continue compiling in Swift 3 mode using Xcode 9. The big limitation is that you won't be able to submit your project to the App Store until Xcode 9 goes final.
Also, Xcode 9 contains a new build system. You don't get it by default: you have to turn it on for this project. Choose File > Project Settings and switch the pop-up menu to New Build System (Preview). This is experimental, but it will be the default build system eventually, so it would be interesting to know whether this makes an appreciable difference.
If you don't want to update to Xcode 9 beta, you will just have to do a binary search: comment out all your code and start adding it back, piece by piece, until you find that piece that's causing the trouble.
The best way to work this out is to find what out what the build is doing while compiling your code. This is a really useful tool to use: https://github.com/RobertGummesson/BuildTimeAnalyzer-for-Xcode
When you run this tool it will show you what methods are taking the longest to compile, and then you fix those. Once you have done that, you can also try the answer I gave here to decrease the build times: Extremely long compilation times with Swift in Xcode

Building ios corePlot with Xcode 5.0 using a Dependent project scenario

I am new to IOS and am writing an ios 7.0 app that uses coreplot (latest version 1.3). I had the "Build active architecture" set to YES - so during the development, I did not run into any linking problem (I used static linking method as described at https://code.google.com/p/core-plot/wiki/UsingCorePlotInApplications
Then I built and deployed on my device (iphone 4, ios 7). It worked fine - I dont remember if it asked to change build settings or not. Today morning, when I tried to run the same code on simulator it started giving me linker error. After doing some research, I realized I need to set the build for active architecture to No and rebuild the core plot using "dependent project install" strategy.
I am stuck at the point where I need to set the header files search path. The compilation fails to detect the header file. The coreplot is in a directory CorePlot_1.3.
The main linking error reads as
"ignoring file /Users/rmenon/Documents/Developer/MoneyTrail/MoneyTrail/libCorePlot-CocoaTouch.a, missing required architecture x86_64 in file /Users/rmenon/Documents/Developer/MoneyTrail/MoneyTrail/libCorePlot-CocoaTouch.a (3 slices)"
As part of my attempt to solve this, I tried to load the coreplot project separately, change the architecure to Stndard (armv7 nd armv7s) and tried to build it. I get two deprecation errors below. Any help in getting me compile this library for ios 7 so I can use the same setting in debug and device would be really appreciated! Thank you!
You'll need to update to a newer version of Core Plot. It has been updated to work with Xcode 5 and iOS 7, but we haven't done a release with those changes yet. You can pull the latest code with Mercurial or wait for the next release, which should be soon (within the next week or so).

Xcode 4.3.2 - One project on two Macs, errors on one, builds on another

UPDATE: QUESTION CLOSED: Fixed myself with a little backtracking. I'm using a framework that requires a source tree variable. (Sparrow). I updated the source tree on my main Mac Mini but not in my MacBook Pro. So, Xcode was searching an old directory due to that mistake.
This may be one of those weird Xcode bugs, so I'm looking for a little advice. I have Xcode 4.3.2 (latest as of this writing Apr 7 2012) installed on two Macs. I have a project saved in Dropbox so I can quickly get at it and work on it from either place. I've done this with several other projects and never experienced this issue.
One one computer, a Mac Mini, the project builds fine. On the other, a 2009 MacBook Pro, I get build errors. For one, even though I'm using -fno-objc-arc on a few of the source files, I am still getting ARC related errors. That is very puzzling to me. No issue when building on the Mac Mini. I'm also getting "file not found" errors pertaining to the .pch file. The error log is pointing me to a strange path like
/var/folders/9l/s_phv6yj0hv6q82_lrdcckb00000gn/C/com.apple.Xcode.501/SharedPrecompiledHeaders/...Prefix.pch' file not found
Here's what I've tried so far
Deleted Xcode and reinstalled from the MAS
Deleted the /var/folders directory called out in the logs
Removed the project build directory
Performed a Product -> Clean in Xcode
Restarted Xcode numerous times
Still no dice. Looks like unless I can nail down this issue, I'll be stuck working from one workstation for this project only. All other projects work fine when doing this.
Thank you for any help you can offer.
I was using a Source Tree variable in XCode, and one of the variables was out of date and pointing to the wrong path. One of the source files that was subsequently updated was working on one Mac but throwing errors on the other, which caused the build to fail and the linker to display strange errors.

Flex ANE, iOS and ARC

Good day
I have created a static library with Xcode. Then I compiled my ANE using adobe's ADT tool. Thereafter I've included the ANE in my FlashBuilder project. However, when attempting to package my project, I get the following error:
"Error occurred while packaging the application:
Undefined Symbols: "_obj_storeStrong", referenced from ...
.
"_obj_release", referenced from ...
.
"
My guess is that ARC is probably not supported for ANE's. I'm guessing that this is probably due to the fact that FlashBuilder is recompiling the entire AIR + the native libs into one iOS application, probably using their own compiler or something (which is why Air apps for iOS can be compiled on windows platforms as well), and this compiler is probably not 4.3 ready yet?
I have attempted adding the flag -fobjc-arc to my ios-platformoptions.xml as well (where this file is the parameter to the -platformoptions flag of adt), but still no joy. It results once again in an error when packaging. Perhaps any other flag I can try to use here?
Any corrections, suggestions, alternative ideas or comments will be most welcome. I am very new to Xcode, Objective C and ANE, so please excuse any incorrect statements or assumptions, and please correct me on these.
I would be glad if somebody can please confirm weather I am correct with my assumption that I cannot use ARC at this stage on ANE's.
Thanks
Christo
START EDIT:
Very late update, sorry.
You might be able to use ARC after all. There is a library called arc lite that I forgot to mention and it works. I created an ANE for MapKit on iOS targeting the 5.0.x SDK. When I tried to move to a device that only had 4.3.x ( could have been 4.3.3 or 4.3.5 ) the app crashed or would not compile. I found information on the arc lite library that is included in the newer sdks, followed the instructions on how to include this library and pow! A working ANE on a 4.3.x device without rewriting my code!
Hope all of this helps and half of my original comment :)
Markus
END EDIT
I don't think ARC is supported just yet. There isn't much to go on in terms of settings or examples of what the settings should be in Xcode. Take a look at any of the Xcode ANE projects you can get your hands on. You will see that most or all of the projects have:
Object-C Automatice Reference counting = NO
Objective-C++ Automatic Reference counting = NO
Take a look at the following:
Vibration ANE - On Adobe Devnet site
Liquid Photo - http://www.liquid-photo.com/2011/10/30/common-native-extension-issues/
Liquid Photo - http://www.liquid-photo.com/2011/10/28/native-extension-for-adobe-air-and-ios-101/
There are a lot of examples in Github but you have to find them via Google. Pull down the Xcode ANE projects and compare the settings.
Hope this helps!!!
Markus

Resources