Xcode variables view empty values while debugging - ios

I cannot see the value of variables while debugging my app. I have already checked the build settings and optimization values are set to none, also my Scheme. See screenshots below:

The idea is to remove things from your bridging-header one by one and see if you can narrow down the issue.
I think I read somewhere that if a library is causing many issues behind the scenes, this can stop your debugger working.
In my case
I was using Facebook Tweaks library
Once I got rid of it, I got my debugging back.
and in my AppDelegate.swift
import Tweaks into the AppDelegate file.
import Tweaks

Moved RxSwift library from the Swift package Dependencies to CocoaPod

Related

Cannot find protocol declaration for *** in my 'MyApp-Swift.h'

I am working on a project that up to now, despite the mess, it was working ok. Today, believe it or not, I have been updating it to Swift 5.
The project has iOS and tvOS targets as well as frameworks, tests, and top selves extensions. The project also was started using Objective-C and over the years has become 90% Swift.
I am not sure at what point something went wrong but, when compiling, I get the following error for all my top self extensions (mostly all tvOS Targets).
I have found similar questions but I can't understand whats going on.
Any ideas?
You are probably missing an import StoreKit in the Swift files that define IAPHelper. Sometimes this gets imported transitively, and Swift doesn't necessarily need it, but the Swift bridging header does.
Ultimately you need to make sure there's an ObjC #import StoreKit; that is evaluated before this line of code.
First, I have to thank Rob for his tips. I wish he could get the points!
After troubleshooting with the tips provided:
Add StoreKit to your linked frameworks list. -> Didn't work
#import StoreKit; before #import <...-Swift.h> -> Showed error use of #import when modules are disabled
I also saw that "...-Swift.h" was only declared in the Build settings of my "...Topself" targets. Still quite unsure why as I would have thought the whole project still have ObjC dependencies... Still quite new to this challenge.
Furthermore, If I unfold the error I could see that there was some kind of error trying to find "...-Swift.h" file.
At this point, I remembered that I am using cocoapods (I don't like you, you don't like me relationship) and I hated to see the warning "...Overrides Enable modules (C - Objective-C)" so I set it to default for the whole project.
Turns out that that for all "...TopSelf" targets, the default value is NO.
By Overriding Enable modules (C - Objective-C) to YES, clean, and build, everything started working again.

Importing CocoaPod into Swift Playground Produces Expression Failed to Parse Error

I have several private pods that I'm already using successfully in my project. I added a Swift playground to the workspace (not to the project), and I've added an import Foo statement to the top of the playground.
Autocomplete is working for my pod modules, so things seem to be set up correctly. However, I'm getting this very obscure error:
expression failed to parse, fixed expression suggested:
#sourceLocation(file: "Foo.playground", line: 1)
It doesn't matter which line I put my import statement on; it always refers to line 1.
There is notably some Obj-C code in the framework that’s being imported. I’m not sure if that matters or not since it’s callable from the Swift in my app.
Any help would be appreciated!
Update (7/21/19): Still haven't been able to resolve this, but I was able to confirm that a much simpler Obj-C library is callable from a playground. So, it's just the complex one I was trying to call initially. Since this is proprietary, there's not a lot of info I can share, but if anyone has suggestions on what to try (or what I can genericize, extract, and share here), I'm happy to take a stab at it and update you. Thanks!

content of variables is not showing xcode debugger

I have tried to debug something in my application.I run the app by setting the breakpoint, but the debugger showed me the variables without any content.
Here is an image of what I am talking about, I don't understand why the blue arrow does not appear in the left for each of the variables:
I have also opened another project and when i debugged that one, it worked. Is it related to the settings in xcode?
This is a problem related to use of Objective-C code in swift projects
Check your Bridging-Header.hand remove all unnecessary headers files from there, check if you are using cocoa-pods you need import all your pods with the import sentence, never include the header of that pod in your Bridging-Header.h
I hope this helps you, I just resolve this problem with this method
Make sure you are running a debug build, not a release build. Release builds use code optimizations that get rid of temporary variables, map variables to registers, interleave the code from multiple lines together so you can't cleanly step through line by line, etc.

Can't see debug info Xcode 6.4?

I think I've accidentally removed some kind of setting or something on a project level. In project A I can see debug info, but in project B I can't see a damn thing while debugging. Local variables can't be expanded to see what they contain, and neither variabels located in self.
As stated earlier, it works fine in one project, but not at all in another. I have no idea what I've done, or how to solve it. I asked around with a few coworkers and none has experienced this before. Kind of need to fix this in order to work efficiently.
Here is a screenshot displaying what I mean:
I don't have any variables in self here, but if I add some or store some, it doesn't work anyway. I can't see anything in self since I can't expand it at all.
Help appreciated!
I found the solution for this. Or rather I found the issue. The issue seems to be with either Xcode 6.4 and above, or GoogleMaps in general. When importing GoogleMaps SDK the debugger stops working properly. Simple as that. Comment out your import of GoogleMaps SDK and the debugger will be back to normal.
Another way of solving this is to bridge GoogleMaps SDK from ObjC to Swift rather than importing it in Swift. I didn't try this, but I saw this as a possible solution here: https://code.google.com/p/gmaps-api-issues/issues/detail?id=8524
Hope it helps someone. Took me days to find this information.

Generic implementation of 3rd party Libraries and Frameworks in Swift

I see there’s many libraries, open source, like Cocos2d, ShareKit, FormatterKit, etc. that seems up to date. (Check GitHub).
But still, implementation, snippets, samples and manual are intended to be written in Objective-C.
But, a method is a method… I think… If I get an instance of any framework/library of these and I call the method in a full Swift enviroment, would I be affected behind the scenes?
After June WWDC Swift gonna get serious, Apple is pushing hard, I’m just getting ready for the move and I don’t want my Apps to implement a soon-to-be deprecated library implementation in Objective-C.
I do not understand your question so much that I will regard your question as "Is it possible to use the Objective-C&Swiftin the same project?"
Yes, Apple claimed that developers can use Bridging-Header to implement double languages development, whatever your main developing language is ObjC or Swift. The specific details and theories about it you shall check from there.
Next I want to tell you some errors occurred in my project when I used Bridging-Header.
I always meet this kind of problem like import 'file not found'. I think you can try to check your file&folder hierarchy. Such as you have a root folder named Project, as is often the case, there is another Project in your previous Project, the root folder.
And Checking the Objective-C Bridging Header in the Build Setting. Sometime error can occurred for Project/Project/Bridging-Header.h. And the error can be corrected by changing the definition as Project/Bridging-Header.h.
If the location of Bridging-Header.h is not matching with the definition in the Build Setting, the error like import file not found will occur.
I just tell your my solution for Bridging issue I already met, I hope it can help you.

Resources