Linking library from Xcode Workspace causes "File is already being linked" dialog to appear - swift

I have an Xcode (11.4.1- though this happened in 11.4 and 11.3) workspace. That workspace is composed of multiple iOS Swift static libraries. One of the libs: lib(A) needs to use another lib lib(B) located in the same workspace.
If I just try to import the module from some source file in lib(A) the compiler won't be able to find the symbols. Fair enough for "Find Implicit Dependencies" to work as I understand it, I have to Link Binary With Libraries; I can accept that, so I explicitly link it:
For lib(A) I go to its target and select Link Binary With Libraries under its Build Phases and select lib(B) from the workspace browser. When I do that I receive a warning dialog:
File is already being linked
If I press Cancel it still adds the selected item under Link Binary With Libraries, but now things build. Why the warning?
The same applies if I were to also add a Unit Testing target to the project for lib(A). If I explicitly link the required static libs, I get that warning. Pressing cancel adds the item, and things work.
Now, "things working" with Xcode is tempting just to back away slowly and take that for what it's worth. However, I'm curious what does that warning mean then/why is it there? Clearly, according to the compiler, the linking is necessary since it does not compile without it. When adding the linking though it seemingly complains about it.

Related

Unknown Type Errors when using functionblocks from my own library project

So I have a library project where I defined a couple of functionblocks and interfaces.
Now I want to use this library in a plc project (in the same twincat solution). So I do the whole save all, rebuild, save and install as a library spiel. If I try to declare a VAR in my MAIN it will result in unknown type errors. I have fiddled around a bit, and when I declare an interface withouth any properties or methods (in the lib) then I it does show up and can be used in the MAIN. But as soon as I add a property or method the class/FB/POU dissapears in the eyes of my MAIN...
I feel like I'm overlooking some option / atribute to help the PLC project to use the lib properly...
What am I missing here?
EDIT:
as you can see in the images, empty blocks are found, adding anything magically makes it dissapear
error
available classes
EDIT 2:
I solved my problem by copying the lib to a new solution. Something in the original project made it be broken. Why it did that is still a mystery...
Try following steps:
clean the solution where you programmed the library.
right click on the project and click check all objects
if this is successfull, install the library again, remove it from the reference section and re-add it.
Then clean again and build all.

Why won't my Swift-backed Preference Pane load? [duplicate]

I'd like to use Swift to build an OS X Preference Pane plugin for the System Preferences app, but I can't get it to work.
After clicking "Next" the Xcode template doesn't offer an option to choose Swift as a language, but automatically creates the project in Objective-C.
Without adding any code or doing anything else, the project builds successfully. If you right-click on the Product and select "Open in External Editor", System Preferences will successfully install and load the preference pane.
It just works!
Well that's great, but now, I want to add a new Cocoa subclass using Swift.
Accepting the default, and allowing it to create the Bridging Header.
Now, quit System Preferences and without adding any code, rebuild the project. As before, right-click the Product and "Open in External Editor".
System Preferences will confirm replacing the preference pane, and it will install it, but then it fails to load.
If you show the built Product in the Finder, in addition to the .prefPane plugin, there's also a .swiftmodule folder.
I'm guessing there's something missing in the Build Phases or Build Settings that's responsible for incorporating the .swiftmodule with the rest of the bundle, but haven't been able to figure it out.
After you add some code that uses the new class, it's necessary to import
the Swift project umbrella header ("Prax-Swift.h") to make the project compile, but importing the umbrella header doesn't fix this problem.
// Prax.h
#import <PreferencePanes/PreferencePanes.h>
#import "Prax-Swift.h"
#interface Prax : NSPreferencePane
#property PraxObject *ourPrax;
- (void)mainViewDidLoad;
#end
I also tried deleting Prax.h and Prax.m and simply implementing the NSPreferencePane subclass in Swift. As before, the project builds and installs, but System Preferences fails to load it.
// Prax.swift
import PreferencePanes
class Prax: NSPreferencePane {
override func mainViewDidLoad() {
}
}
Sorry if I've used too many pictures in this question; it seemed to be the clearest way to explain the problem and make it easy to reproduce. There's probably a simple solution. Any ideas?
First, you need to enable the "Embedded Content Contains Swift" setting so that Xcode will copy the necessary Swift libraries into the bundle.
Then, you get this error:
System Preferences[68872]: dlopen_preflight failed with
dlopen_preflight(/.../preftest.prefPane/Contents/MacOS/preftest):
Library not loaded: #rpath/libswiftAppKit.dylib
Referenced from: /.../preftest.prefPane/Contents/MacOS/preftest
Reason: image not found for /.../preftest.prefPane
This means the app doesn't know where to load the included Swift libraries from.
To fix this, add #loader_path/../Frameworks to the runpath search paths in the build settings, telling it that the Swift libraries are in the Frameworks directory of your prefpane:
See the dyld man page for further info about dynamic loading.
There was an Apple bug introduced with macOS High Sierra. This bug is now resolved in the latest dot release of macOS. See https://github.com/klaas/QlaasSwiftPreferencesPane for a working sample project.

Xcode 4 - renamed/deleted file, yet get 'file not found' error

I just used Xcode's refactoring tool to rename a core data class from Player to Person. After fixing about 100 errors resulting from using dot notation that Xcode missed in the rename, I got to the last one:
Player.m - Lexical or Preprocessor issue - 'Person.h' not found
Player.m no longer exists in the project, and shows up as deleted (empty icon) in the error. Obviously, since I got rid of it, I don't want it to exist anymore!
To fix this, I have tried re-adding an old copy of Player.h and Player.m, and also cleaning. I have checked the Build Phases->Compile Sources section, and Person.m is there, Player.m is not. Person.h does in fact exist.
Not sure if it matters, but I am using mogenerator to generate my core data classes. Also, this is my third xcdatamodel version. Versions 1 and 2 used Player.h.
Here is a screenshot of the error:
Try clean build, if that doesn't work, restart Xcode, if that doesn't, delete the DerivedData directory, maybe even reboot.
Xcode sometimes gets confused.
You can try to do a super clean (not sure what the real term is) by hitting Cmd+Alt+Shift+K. This performs a clean and removes everything from the build folder.
Well I had a very similar problem and solve it removing the missing compile source of my project settings. to do that follow these steps
Click at the project page. This page contains the general settings
of your app
Select Build phases.
In Build Phases section, select compile sources.
If there is missing some class or file or something that needs to be compiled.
Select water mark file and click the minus sign at the bottom of this section.
Just click and the project may run. I hope this help others.

Packing an Actionscript (Flash Builder) application for iPhone

Recently I tried to build a flash application in Flash Builder, and I wanted to export it to my iPhone. I have gone through all the required steps in order to certify my application.
Now, with all that done, all that was left to be done is building the ".ipa" file in Flash Builder. Now, this gives the following error:
'Launching TestGame' has encountered a problem.
Error occurred while packaging the application:
NotBefore: Wed Apr 11 18:52:40 CEST 2012
Google didn't give me a decent answer, nor does Adobe's information regarding mobile application development. All I can think off, is that I can't build the application before that date. That's ridiculous, I can't imagine a certain check like that.
I'm pretty sure my ".p12" key file is generated correctly.
Is anyone else familiar with this error? Please, be so kind to guide me in the right direction.
Kind regards,
Matthias.
The error occurs because the compiler didn't find the files under the corresponding directory such as debug-bin or release-bin folder. (explains from: http://forums.adobe.com/thread/893772)
For example, if you are doing a debug-build, and you didn't select the project option: copy non-embeded files to the output folder. And debug-build needs some files such as icons files under the debug-bin folder, and it couldn't find it.
Solution: select project compiling option: the copy non-embeded file to the output folder.
Try again, if still not you will need to try the ADT build to get more details http://help.adobe.com/en_US/air/build/WS901d38e593cd1bac35eb7b4e12cddc5fbbb-8000.html
I suggest compiling from command line. I'd ported an AIR app to iOS and compiled using adt dirrectly (without FB or whatever), and there were more meanful messages then yours. Take a look at the manual on how to build ipa wit adt. The other advise is to check your iPhone node in app.xml (take a look here) and icons.
The "error" was thrown because the certificate wasn't valid yet. It became valid on the date shown above.
You could also fix the manifest file in the iOS developers center.
This problem does come up more often than needed. The error reporting is lacking distinctions but is also difficult to asses since there can be many factors causing this error. If it was one factor or even just a few then it would most likely let you know.
A great way to ensure that the error reporting can do its job and tell you where the problem is is to check your error log. It will tell you at least a few of the places that threw the block.
If you are unable to read those strange glyphs then just ensure that all your resources are being packaged. This does mean a little time of list checking but it is well worth it, for the errors and to get rid of development junk.
The first step in the asset list check is to go through each part of your Assets class (flash builder reference). If you do not have a direct Assets class then you may want to make one and move all of your asset calls to that one class - since it will save you time if this happens again.
Your Assets class is not the same as your Assets folder. Your folder is where the files are stored - i.e. images, bitmaps, sounds, etc. Your Assets class is what categorizes and assigns references to each individual file.
Go through your Assets class to ensure that each of those files exist in the folder as well. Then go to the Project menu (top near Navigate and Search) and select Clean. Either clean all your projects or check the current one. Once this is done you need to click on your Assets Folder (right click or highlight and hit edit or whatever), and select Refresh. This will check that all the files are still there and get rid of/update them.
If none of this throws an error -red X- or other errors then you need to check your project .xml file. This may take you some time to ensure that all of your add on packages and details are correct. Make sure you have the correct:
at the top and it matches your current air release.
Make sure all the filenames, names, ids, version numbers, aspect ratios, fullscreen, visible, icons, extensionIDs, and everything else are not only correct but actually there. Most of these statements should have something written and not be blank. If they are blank find out what to put in.
Ensure that you have the proper icon file extension. If it says assets/icon48.png and the icon48.png is actually in assets/pictures/images/icons/toomanyfilesextensions/whatever/icon48.png
you need to fix that link.
The last thing that you will need to check is when you want to either Release Build or Debug. You need to make sure that all assets are checked and selected.
Go to Project - Properties.
then select ActionScript Build Path.
Click the Native Extensions tab and see if there are any red X's. If there are tap the little arrow beside them and see what the matter it. Add the correct ANE or get rid of it or whatever you need to do.
Then in the same menu go to the left and select ActionScript Build Packaging. A little arrow should be beside that one too. Tap the arrow and it will open to Apple iOS, BlackBerry, Gooogle and whatever else you have (probably nothing more). Select the OS your want to use, lets say Apple, and you will have 4 tabs pop up. Make sure you have the correct certificates selected. If you have none or are confused about this you need to spend some time on Google.
The biggest one for this error is under the Package Contents tab. Most people miss this!
Open the tab and see if anything is not checked. There will 99.99% be something or many of them not checked if you are getting this error. Just check them all and you can figure out what you need and don't need later. Some of them will be listed because you just threw in a bunch of ANEs and .SWFs to have some awesome app. Those add on packages will throw in unnecessary contents into this package. That is fine and don't worry until you want to be picky. Just make sure they are all selected and hit Apply and Ok.
That's it. You should have a working Release Build if you did everything else correct and this error should be easy from now on (but time wasting).
You may get a 'slip' error now, but that is another story. But that is a great sign because you are getting closer to that stupid mistake that we all make: the elusive spelling mistake.

xcode4 lost auto completion ability after importing three20 libraries with python scripts

The auto completion ability just disappeared when installing three20-install scripts like
http://three20.info/article/2010-10-06-Adding-Three20-To-Your-Project
Therefore, even when I type self. , nothing can appear , but it should pop out the functions with a list.
(my xcode4 is 4.0.1)
Anywhere to correct this ?
You should install Xcode 4.0.2, I think its indexing is more efficient. (or less bugged...)
Make sure to clear Xcode index in DerivedData folder or from "Organizer window > Projects". Then make sure the full project builds, including dependencies, especially three20. Eventually, restart Xcode, rebuild, that should fix completion.
If none of above works, check that three20 "Header search path" are correct.