How can I debug carthage (owned) dependencies in my iOS application? - ios

I have an iOS application project with couple of private(owned) carthage dependencies, sometimes I'm in the need of debugging bugs or to know what is the code executed by certain methods.
I'd like to know if there is an easy way to setup the framework source code in Carthage/Checkouts using a run script, so that if I do a carthage update and run my app a can debug the frameworks source code without the need of adding sub projects.
Can this be done by including the debugging symbols in the framework build if so what would I need to do, to make it work?

Did you tried to copy the dsym files as mentioned in Carthage - Getting Started?
With the debug information copied into the built products directory, Xcode will be able to symbolicate the stack trace whenever you stop at a breakpoint. This will also enable you to step through third-party code in the debugger.

Related

How debug Kotlin on iOS with Xcode

Currently I am working on one KMM project. It would be really useful to be able to debug the shared code which is in kotlin in xcode project.
I am aware of this solution but I have problem to tell Xcode that *.kt files are source files
to be more specific in the above github link it is written :
You need to tell Xcode that *.kt files are source files, and run an lldb formatter script when debugging starts. Advanced users may want to do this manually, but if you have Xcode installed in the default place, you can run the setup script.
Unless you're using Xcode 11 (in which case look here for help), the following script will install both debugging and formatting support:
./setup.sh
I do not know where and how I should run the ./setup.sh or if there is another way to do it?
The setup script is included in the github repository: https://github.com/touchlab/xcode-kotlin/blob/main/setup.sh
The above plugin is great if you want to debug on Xcode and I highly recommend it.
Just an FYI, in case you didn't notice, there is also a plugin for debugging shared code on iOS for Android Studio: https://plugins.jetbrains.com/plugin/14936-kotlin-multiplatform-mobile

How to debug iOS native code in a flutter plugin?

I'm wonder how to debug flutter iOS code in a plugin?
I can open the example app that's generated whenever you create a plugin but I see the plugin code as binary framework, therefore I can't debug it.
For android it's fairly easy, I just open the android folder in A.S. and the plugin + the example are there, I just add run configs and I start debugging right away.
But I really hope to find a similar way for iOS.
Plugins are added to the ios app as pod projects so it is similar to debugging any code in pod project.
Open Runner project workspace
Browse the file in the Pods project
Put Breakpoint
NB: Need to run app from flutter first to work this properly
To set a breakpoint and debug Flutter plugin code from Xcode, try the following:
Open ios/Runner.xcworkspace for the Flutter application you want to debug.
From the Debug menu, select Breakpoints > Create symbolic breakpoint...
In the Symbol field, enter the method you want to break on. For example, to break on the default entrypoint for the plugin defined in the HelloPlugin class, set the symbol to -[HelloPlugin handleMethodCall:result:].
Run your app from Xcode via Product > Run.
From that point, trigger the plugin code through whichever UI actions will hit the code in question.
Make sure to build the example app first using cd hello/example; flutter build ios --no-codesign, then open it in Xcode.
You can find files for the iOS part deep in the project hierarchy: Pods > Development Pods > name_of_your_plugin > ... > Classes
You can put breakpoints in the Xcode as you would normally do, and then you can run the example app straight from the Xcode.
Reference from the Flutter team.

Slow compile times with react-native iOS app

I am currently working on a react-native iOS app. While developing I noticed that the compile times for the app are really slow. I got a CI hooked up which roughly does the following:
clean git checkout of the applications workspace
run unit tests
run UI tests build the app
Since this is a clean checkout the app always recompiles all of the react static libraries which come with the React.xcodeproj like libyoga.a, libReact.a, etc. This means that a clean CI build roughly takes ~8min only to build all of the react dependencies (~4min * 2 because the UI test target rebuilds React again).
I wondered whether it would be possible to speed up the compile times. I came up with the following idea but need your advice to tell me if it would work or if I am on the wrong track.
Compile all static libraries for iphoneos and iphonesimulator
Put them together in a single file via lipo
Move them to a folder
Put that folder into version control
Link the libraries in that folder into the Xcode project
This way it would only be necessary to build a new set of static libraries if I update the react-native version in the package.json, right ?
Another idea which came to my mind is to build a dynamic framework of react-native. The framework could be build only once and then added to the application via carthage or manually. The dynamic framework would link all the react static libraries and add the correct headers to the header search paths.
Does anyone can give me a hint if this could work or has an idea how to improve the build architecture in order to speed up the compile time ?
Check these two checkbox
1 Show environment variables in build log
2 Run script only when installing
but when you run first time then uncheck it because this load script for first time otherwise you can not open get loading script in packager.

PLCrashReporter frameworks integration produce "Could not inspect the application package." error

I am actually trying to integrate PLCrashReport using either a Framework (the one given on the official website) or Carthage.
Carthage won't compile the framework, and the manual drag & drop with the one downloaded from the website would produce the following error when installing the app on the device (Run build)
App installation failed
Could not inspect the application package.
I use a build target of iOS8, I linked the framework as an embedded binary to ship it with the app ; and this error is very annoying.
Xcode is in 7.3
Right now, I tried manual build for the framework, clean of the project. None would work.
By curiosity, I tried Cocoapod integration for this library, it worked, but Cocoapod is NOT an option on my project so I can't go with it.
Does anyone have had the same issue, any ideas for correcting it ?
Finally found a way to make it work :
PLCrashReporter should NOT be in embedded frameworks, just in linked frameworks. Works like a charm now, debug and release builds !

Remove fabric framework from ios app

I have been landed an iOS project from a client. The main task is to explore and see the user interface so that multiplatform app will be made from scratch with Xamarin.
I notice that the project uses third party framework called fabric. From what i see it is used from crash analytics. I don't need that and i don't have registration so i want to remove all dependencies from the project.
So far I did:
Deleted define ENABLE_FABRIC ( which removed some code from
AptDelegate, replaced logging messages with plain NSLog etc)
Removed some fabric script invocation from build phases
Removed reference from fabric framework in project
So i still have errors building my app:
/bin/sh:
/Users/macmini/Library/Developer/Xcode/DerivedData/../Build/Intermediates/../Script-FDC6FCE81A4488D000F2613D.sh:
(null): bad interpreter: No such file or directory
Does anyone know a quick way to get rid of this?
I know it's an old question but I want to help. When you install Fabric, previously Crashlytics, it asks you to put a script in project->Build Phases-> Run Script
it will look like this
./Fabric.framework/run 123456fd7ec....6e2170Q
I think you should remove that script and other Linked Frameworks and Libraries and then it possibly could run
Try deleting the files DerivedData path and clean build folder
cmd+opt+shift+k
then re run the application.
Also check once again the Framework search path in xcode settings.

Resources