#if DEBUG isn't work on some device for TestFlight version - objective-c

The below code is work for direct running, but some weird situation occur on TestFlight version. I use Debug build configuration for my archive.
There is a button show on DEBUG mode that is work properly. Tap the button is going to show a table that contains a row and tap the row will perform some action on DEBUG mode. but some weird thing happened the button is show but the row do nothing after tapping. There is a more weird thing. I have a device is work totally fine but other don't.
I have tried to add -DDEBUG on other swift flag but not work.
Any idea welcome.
#if DEBUG
// swift code ...
#endif
#ifdef DEBUG
// objc code ...
#endif

If you want to branch out from your existing project, you need to set up a separate project target.

Related

How do I make a conditional compilation statement for release builds in VB.NET?

I have some code that I want to skip if we're running a debug build (it's supposed to send an email but that requires an email server which is not available when debugging).
I tried all of these:
#if !DEBUG
#if RELEASE
#if not DEBUG
but all of them misbehaved (the code was either grayed out for a release build or not grayed out for a debug build).
I even tried
#if DEBUG
' dummy blank block
#else
' code goes here
#end if
but the code in the else section is always highlighted, even when I'm in debug mode...
What is the proper way to do this?
When switching to debug mode Visual Studio grayes the Else part because It wants to tell you that you are not in release mode that's why when you switch to release mode it grayes the first part because you're not in debug mode that's all
that was meant to help developpers (I don't know why you can just look up in the selected mode)
Dim blnDebuggin As Boolean = False
#if (DEBUG)
blnDebuggin = true
#else
blnDebuggin = false
#endif
You can also use this to identify the application running mode
System.Diagnostics.Debugger.IsAttached
and i hope this one should work too
HttpContext.Current.IsDebuggingEnabled
Taken from here [Click me ^^][1]
[1]: https://forums.asp.net/t/1552928.aspx?How%20to%20know%20whether%20application%20is%20in%20release%20or%20debug%20mode%20using%20vb%20net%20code

"Lost connection to 'My Mac'" on every debugger interaction

I'm trying to debug my program. The breakpoint works, but when I click Step Over (or do anything else with the debugger) Xcode says:
I've tried deleting the derived data and cleaning the project, and that doesn't help. I'm using OS X 10.11 and Xcode 7.2.
Edit: It seems to have something to do with my project. The code is at https://github.com/vindo-app/vindo, I'm working on the menu branch. The breakpoint is at Models/Start/StartMenu.m in -addItemAtURL:

Xcode 6 Swift code completion not working

Using Xcode 6 GM seed my code completion has stopped working. It was working the other day. I was trying to get the unwind segue work around to work. I had made an Objc header file and assigned it as a header for a Swift class.
At this point I get code completion with an Objective-c project. But, not with a Swift project.
I have tried restarting Xcode, making a new empty project.
Just go in user->Library->Developer->Xcode->DerivedData and delete the Data of folder(Derived data) and restart Xcode.
This fix from apple dev forums works for me. I have had autocomplete issues with Xcode 6.1/Yosemite.
Quit Xcode.
Restart the computer (this is to clear any in-memory caches).
Delete the contents of the DerivedData folder (~/Library/Developer/Xcode/DerivedData), precisely run, a) cd ~/Library/Developer/Xcode/DerivedData/
b) rm -rf *
(Try this if Steps 1-3 dont really work as it rebuilds the cache later on restart which takes time) Delete the contents of folder ~/Library/Caches/com.apple.dt.Xcode, i.e., a) cd ~/Library/Caches/com.apple.dt.Xcode b) rm -rf *
Now launch Xcode once moreā€¦
I experienced a serious breakdown of code completion because I had some 'notes' after the #end statement of my .m file which were as follows:
/*
NSAlertFirstButtonReturn, NSAlertSecondButtonReturn, NSAlertThirdButtonReturn
*/
These lines can appear before the #end statement without destroying code completion.
There's an easier way to delete the Derived Data from within Xcode (no need to open finder or restart):
Xcode Organizer -> Projects -> (Your Project) -> Delete Derived Data
I just recently had this problem. Autocomplete did not work ...and when i typed for example tableView.... it did not give me the different functions available.
I tried the following and it worked for me.
Xcode Organizer -> Projects -> (Your Project) -> Delete Derived Data
delete the file ~/Library/Developer/Xcode/DerivedData/ModuleCache
Restart xcode
Hope this works
Another possible reason why it isn't working is because it's not part of the target membership. To fix this, select the file you're working on. Then, go to the File Inspector and in the Target Membership section, make sure your project is checked.
Try the following - as silly as it may sound:
Change Device to iPhone 6, close Xcode, Reopen Xcode and wait for the indexing to finish.
Go to Xcode menu, then Window -> Organizer, then select Projects. Pick your project and press on delete button beside dervied data
Then restart Xcode
That solution worked with me on Xcode 6.1
If your code completion problem is only with UI classes (e.g. UIImage, UIDevice), then you just need to add "import UIKit".
Swift files will NOT have code completion for UI classes unless there is an "import UIKit".
I had the same issue but under different circumstances,
I have 2 projects in my workspace
Swift framework for iOS and OSX
iOS Project (which uses the swift framework)
My code completion works fine in iOS but it keeps failing in the swift framework. I tried all the about solution and had no luck and was killing my productivity.
Finally i figured out the solution to this problem.
Select the file you are editing (in the framework )
Select the 'utilities' tab on the right
uncheck the Mac target (just keep the target you are working for
currently)
Thats it, this solved my problem.
hope it helps someone who is in this kinda situation.
user/Library/Developer/Xcode/DerivedData Delete all the files shown in this folder. after that go to your project name and clean project then come back to the file where you wanna see suggestions. Type any word and its done.
So all you have to do is make sure, in the file inspector view on the right side, under Target Membership, the first box is checked. I'm not sure why this changes things but I'm sure someone can come along and give a more complete answer.
In my case Some File(s) were deleted in File System but were still referenced in the Project i.e. in Red Color. Just delete those from Project and everything was fine. Code Completion started working.
Also Like to point that all the above answers about Clearing/Deleting Derived Data folder seems to work momentarily but whenever there was a new pull or update the problem started again, so the root cause was the unreferenced/moved/deleted files which show up as RED in the project, they needs to be manually cleared.

DEBUG directive not working

In my .NET MVC 4 site I use #If DEBUG Then in a few places. Lately I've noticed that there seems to be some issues with the DEBUG variable. This issue keeps happening
Here is some code I put in a controller action to test my problem:
If DEBUG Then
ViewData("test") = True
#Else
ViewData("test") = False
#End If
If I run my site multiple times alternating between debug and release modes, at first the code will work but after a few tries, the code block above will get stuck into thinking it's in release mode or get get stuck into thinking it's in debug mode. At this point it doesn't matter if I'm in debug or release mode, the stupid thing will cling to whatever value it got stuck on and go to the code block for that value.
In release mode the = True line is greyed out. In debug mode the = False line is greyed out. So that works. But the code might still run a greyed out line if that code corresponds to the value the code is stuck on.
Things that don't fix it:
-alternating some more
-restarting VS
-restarting computer
-unloading project
The only thing that seems to fix it is changing the conditional statements or adding more #If DEBUG Then code somewhere else. It's as if the compiler doesn't reread the conditionals until something changes. This only happens on one VS project I'm working on and doesn't happen for other projects.
This may be something that you left out of your paste but in the first IF you are missing # it should be #If Debug instead If Debug.

Why is my xcode jump to assembly view when break point set?

When I try to debug with breakpoint, it jump to assembly view like this no matter which line of code. I want the highlight of current source line back!!
How can I config it??
This is a useful feature sometimes, but is easy to turn off:
Debug > Debug Workflow > Always Show Disassembly
In older versions of Xcode (<6.1):
Product > Debug Workflow > Show Disassembly When Debugging
I'm having the same issue in Xcode 6.1 and solved it by doing the following:
Debug -> Debug Workflow -> UNCHECK Always Show Disassembly
Make sure "Always Show Disassembly" is unchecked
You can try this
Product > Debug > Create Symbolic Breakpoint
I agree with humphriesj regarding "Always Show Disassembly" in Xcode 6.1, and it did work for awhile.
But for me it seems to have turned itself back on, even though it was still unchecked in the menu. I turned it on and then back off, and finally I can see the source code again.