Unable to debug a framework in Xcode 8 - ios

I have a framework project I built in debug mode. I added such resulting framework to another iOS project. My iOS project builds correctly and the framework is called, I get its methods results. However, some of the results are not the expected and I need to debug the framework's code from the iOS project.
I am also running the iOS project in debug mode and setting a breakpoint at the framework's method call I want to debug. But "step into" instruction in the debugger does not enter into the framework's code. In addition, if I "command-click" the name of the method to try to go to its code, I get an:
Couldn't Generate Swift Representation
My issue is similar to this one, but the answer there is not working for me. Is somebody experiencing the same? Could somebody provide another solution?

Related

iOS Embedded Framework with Embedded Framework

I'm working on a framework which embeds another framework (from CocoaPods) for error logging on iOS. This is working very well, and I can embed such a framework in an iOS application for testing, codesign everything, and debug on my own device easily. Unfortunately, when attempting to upload such an application to Apple for distribution, I get an error message as such:
Invalid Bundle. The bundle at '<myapp>.app/Frameworks/<myframework>.framework' contains disallowed file 'Frameworks'. With error code STATE_ERROR.VALIDATION_ERROR.90206 for id ***
I'm not sure if this message indicates that I'm not allowed to embed a framework in another framework or what. It seems the automatic codesigning Xcode is doing is not recursing to the deepest embedded framework upload (I have a script to manually sign everything on build). Does anyone have experience with an error like this or know where to look? It seems others have asked questions about embedding frameworks in other frameworks before, but most of these are how to get linking to work or how to properly reference these nested frameworks. My issue is specifically if I am allowed to upload such things to test flight/the app store, and how to do so if it is possible. Most people having this issue seem to have disabled swift support, but none of the projects I'm using have swift code.
Nested bundle cannot include a framework. You can check this apple document.
iOS and tvOS support frameworks and Swift system libraries at the topmost app level; a nested bundle, like an app extension, can’t include a framework.
And there is a warning block that worth being noticed:
If you put content in the wrong location, you may encounter hard-to-debug code signing and distribution problems. These problems aren’t always immediately obvious. For example, when building a Mac app, incorrectly placed code might work during day-to-day development, but might cause problems during notarization.
So that is the reason everything seems normal while running in debug mode but failed at distribution.

Created a custom framework in swift and app is getting crashed

The only error it is throwing is "dyld[1233]: missing symbol called". The digits inside braces get changed all the time. The code I have checked on the App side works perfectly without any crashes. But the same code when I migrate to SDK (with public specifier) it crashes.
Please help me, This is my first time working on SDK.
Note: - The agenda of SDK is to pair with the BLE device (via Bluetooth) and update its firmware(DFU).
The pairing code in SDK works well, but while updating the DFU of the device, the app crashes.
Things which I tried,
General-> Frameworks, Libraries,Embed contents -> embed and sign
Cross checked whether any issue from the code side, seems it is an SDK issue
Rearranged the order of custom wayband SDK under General-> Frameworks, Libraries, Embed contents

iOS - Framework files showing when app crashes from integrated base project

I have created a framework and integrated into the base project for execution case my framework implementation may miss out like:
array out of bounds error
null pointer exception
For this type of scenarios, the app crashed due to the above exception (test.framework) at the same time framework implementation files showing only when the app crashed.
Please let me know if there is a way to fix it?
Reference : https://instabug.com/blog/ios-binary-framework/
Your framework contains debug information which includes file locations.
Since you are using the same machine, lldb debugger is able to locate the source code where your app crashed.
You can move the Framework's Xcode project to different location on your Mac to see the difference.

(Class) is unavailable: cannot find swift declaration for this class ONLY for iPhone <= 5 simulator, Generic iOS Device and Release Build

I understand that many similiar questions have been asked in the past - however, none of them exactly applies to my situation.
I am using the AudioKit framework in my app. I added the framework by copying the framework into the app directory and adding it to embedded binaries. It runs perfectly on the iOS simulators after the iPhone 5 simulator (i.e. 5S plus). However, when building for: earlier simulators; Generic iOS Device; and my device (which is an iPhone SE) I get the error (Class) is unavailable: cannot find swift declaration for this class where (Class) is every single AudioKit class in my code.
As per this answer I've checked the framework's Modules folder and the only files there are x86_64.swiftdoc and x86_64.swiftmodule. As I understand, to build for a real iOS device I need an arm64.swiftmodule. However, I cannot figure out how to create this file/where to find it.
The linked question would suggest that I need to change the framework's deployment target, but I can't figure out how to change it (or even where the framework's deployment target is stated).
I have tried creating a new xCode project, building it from the start for Generic iOS device, then adding the AudioKit framework - but I still get the same errors.
Finally decided to give up trying to make it work. Used Carthage instead - works perfectly. If anyone else has this issue - just use Carthage.

EXC_BAD_ACCESS when trying to run Unity game on iOS simulator

I'm usually not a Mac/Xcode user, please forgive me for incorrect terms or understandings.
I have a 2D Unity game which I can successfully build and run on Android and Windows Phone devices/emulators. When building for iOS, I can successfully create the Xcode project, open it and build the app in there. The only change in the iOS-specific player settings I made was to set SDK Version to Simulator SDK.
However, when trying to run it inside the simulator, the splash screen appears, then Xcode pauses on something that looks like an assemby file with an error message: Thread 1: EXC_BAD_ACCESS (code=1, address=0x4).
As I had no idea on what to do, I started stripping down my project (in Unity) until I had no more gameObjects but the camera left on the start scene. Also, I removed all other scenes from the build. The only thing that changed was that above error message now seems to appear on another assembly file.
What could be the issue here? How should I investigate further?
Update
This is the stacktrace:
Update 2
I've created a new blank Unity project, and I get the exactly same error there. The problem seems to be related to Unity or my machine, not the app itself.
Workaround
After days of researching, I still couldn't resolve the issue and finally built for a real devices instead of the simulator. Since I don't own one, I "blindly" submitted the result to the app store, and it got accepted.
For me, that's the proof that the issue is solely related to the combination of Unity and the iOS simulator, i.e. that those two don't work together reliably.
On the other hand, it seems relatively safe to assume that an app will work on iOS if it's been successfully tested on Android, Windows Phone and the default player. Of course, unless iOS-specific features are implemented.
I only know one reason, that leads to this behaviour (device builds work, but simulator builds won't).
=> This could happen, when using native iOS code / plugins
To fix that, you'll have to modify the <path-to-xcode-project>/Libraries/RegisterMonoModules.cpp file, cause somehow Unity does not register those classes/methods for the simulator.
Just look for #if !(TARGET_IPHONE_SIMULATOR) defines and shift them to have all your plugins included, also in the simulator. There will be some move mono_dl_register_symbol() that you'll need.

Resources