Cannot find 'ConfigurationIntent' in scope error - ios

Adding a Widget Extension target to a new or existing iOS project leads to a bogus error when building the project: Cannot find 'ConfigurationIntent' in scope. Cleaning DerivedData / project does not help.

It turns out that if you have a Class Prefix assigned to your xcode project document settings, xcode will silently add the prefix to the auto-built configuration intent class but this isn't obvious because the configuration itself does not contain a prefix.
In my case I had a prefix TDD. I spotted the file TDDConfigurationIntent.swift in the build folder. The solution is to either rename the configuration intent manually OR remove the class prefix in project document settings.

Related

add module into ios framework, app get "module not found"

I have a swift framework project(let's call it Framework1), inside it use some 3rd party objective c files. I use module instead of umbrella file because of ambientlight's answer in this post
I create a subfolder(let's call it MiscModule), put module.modulemap under that folder, include all oc headers, and configure the Build Setting. The framework build fine, I can get framework build.
But after I put Framework1 in app project, build the app. It complain about "Module MisModule not found".
I saw the Framework1-swift.h file have an line of "#import MisModule". I had thought MisModule is build into binary in Framework1's bundle.
Do I miss something?
When you built it, those files that in modules did not be embedded into the framework, it would change the relative path to absolute path.
such as import YourModule change $SRCROOT/... to User/YourProject/
so, not use custom module in framework, it will change the import paths to
absolute path.
Your can build a framework for the oc files.
Sometimes cleaning Xcode, restarting both the simulator and xcode, and then trying to run again helps. If worst comes to worst, try heading into finder and doing a deep-clean. Delete ~/Library/Developer/Xcode/DerivedData/

iOS : Could not build module <framework-name>

I've got Library from another team. I'm trying to use library in our project and while do so getting an error Could not build module 'Common Library' (name of framework)
Below are solutions that I worked on but didn't helped :
1. Delete Derived data content. Clean and Build.
2. Framework is added in 'Link binary with libraries' of Build phases.
3. While adding framework checkmarked : Target and Copy content to folder.
Even I tried this stackoverflow-link but didn't got any break-through!
The only thing that worked was deleting Objective-C bridging header path in Swift compiler - code generation section of build settings in Project.
However, thereafter I'm not able to get Common interface to create instance (i.e. Common dosen't appears in drop-down list)
Below is framework structure.
Any other fix?
you can try delete DerivedData dir.
where is DerivedData?(xcode 8)
go to File > workspace Settings, you'll see DerivedData path.
DerivedData path in xcode 8
Check whether the framework you are integrating is supporting your project architecture.
To see the framework supported architecture, use Terminal and navigate to Framework folder.
use, "lipo -info myFramework.framework/MyFramework"
And, if you want to use the framework files in your project, check whether the files are available in Framework/Headers Folder.
Getting this error :
Try, "file myFramework.framework/MyFramework" in Terminal
I think you does not need to compile CommonLibrary.framework again. So you can try to remove it from Embedded Binaries list. And make sure the path of CommonLibrary.framework is in your Framework Search Paths.
I also had this problem:
1. My 'GoodLuck' framework had two headers: GoodLuck.h and GLAdder.h
2. Project which import this framework couldn't compile
Solution:
Import GLAdder.h in GoodLuck.h, rebuild the framework. It works.
I also had this problem, due to a typo in my GCC_PREPROCESSOR_DEFINITIONS, which therefore invalidated all of my code.
First helpful warning was multiple "Macro Name must be an identifier" followed by multiple "Could not build module" messages.
As this question do not have answer yet, so adding my answer here it may help in future for some another developer.
I know due to privacy you can not disclose the details.
I have used same library and faced same issue so just did did this two things it is working fine.
In General -> Frameworks,Libraries -> CommonLibrary.framework just select that and choose -> Embed Without Signing.
Build Settings -> Search for "workspace" -> Validate workspace -> set it NO
That's it you are done.

Shared internal framework not found after renaming project

I have a swift Xcode project say named Motorcycle and it has an internal framework shared among targets called MotorcycleKit. After I rename my project to Rollerblades I see in the project overview I now have a RollerbladesKit instead of MotorcycleKit. After doing a find and replace on import MotorcycleKit to import RollerbladesKit and running the app I get a module not found error on my import RollerbladesKit. How do I fix this error?
The Xcode rename function has a bug where it renames shared internal framework's Project Name to the exact literal of the new project name if the shared internal framework's name has the name of the original project in it. So from the question. MotorcycleKit has Motorcycle in its name and it gets replaced with Rollerblades instead of RollerbladesKit. You can fix this by going to your framework's Build Settings > Packaging > Product Name and correcting the name there, in this case by appending it with 'Kit'.

Regenerating the Bridging-Header and -Swift.h files after project name change

I have previously built a Keyboard extension project that has components of both Swift and Objective C. I'd like to built a new Keyboard app based on my previous app, with the simple goal of changing the name, keyboard UI and some keyboard mechanics.
I followed the guidelines here on duplicating and renaming an XCode Project. I even managed to get the project to compile after changing the Bundle IDs (for both the container app and the underlying keyboard). However, because of the name of the Targets have now changed, I am get the error that the following files:
#import "NewNameContainerApp-Swift.h"
#import "NewNameContainerApp-Bridging-Header.h"
cannot be found (these errors persist despite me manually changing OldNameContainerApp-Bridging-Header.h to NewNameContainerApp-Bridging-Header.h. It seems that the project has not regenerated a new set of bridging header and -Swift.h files matching the names of my new target.
My question is - is there a way to force XCode to regenerate a new set of these files? And if not, where do I find OldNameContainerApp-Swift.h so I can manually change it to NewNameContainerApp-Swift.h?
Thanks!
Check in your applications Define-Module in the build section. Update it to your latest project name. To find it easily just search for Defines-Module and see if it needs updating. If it is updated try cleaning your project or deleting your Derived Data
I have found no way to force Xcode to regenerate these files. Removing them just causes builds to fail. The only reliable method is to do a clean build, or removed DerivedData and rebuild (effectively the same solution).
When renaming an Objective-C/Swift mixed app, the following additional changes have to be performed for a successful build.
The Swift to Objective-C header file depends on the module name:
<ModuleName>-Swift.h
So if the Module name changes, you need to change the import in your code. In build settings search for Product Module Name to find the module name that is being used.
The Objective-C to Swift bridging header name depends on the build setting Objective-C Bridging Header. Check the Xcode target build settings and modify to match your new name.

Xcode 6.3 can't find watchkit extension swift file

We have a mixed code base in our WatchKit extension. In a couple of Objective-C files, we need access to the Swift code base from the extension. We've been using the following import:
#import "MyProject_WatchKit_Extension-Swift.h"
This has worked fine for the entire dev process.
I am in the process of moving to Xcode 6.3. After updating our code base to Swift 1.2, I'm getting File not found for my extension-swift file.
What I've tried:
Full clean w/ cmd + opt + shift + k
Deleted derived data
Deleted and reinstalled Xcode
Changed extension module name and used that import
Reverted to pre update commits and updated manually as opposed to the automated: `Convert > To Latest Swift>
Anybody have any thoughts.
It seems Xcode has changed it's default behaviour for file paths defined in the target's build settings. Previously it was happy to look recursively for a file within the project directory, so you could just define the file name and you were good to go. Now you need to prepend the folder name.
Go to your targets build settings and search for 'Objective-C Bridging Header', you'll probably see the entry 'MyProject_WatchKit_Extension-Swift.h'. You need to prepend the path to the file relative to the root project folder.
If your folder was structured as so:
PROJECT_ROOT_FOLDER
- CLASSES_FOLDER
-- MyProject_WatchKit_Extension-Swift.h
- .xcodeproj
- TESTS_FOLDER
Then you would need to change the value to
CLASSES_FOLDER/MyProject_WatchKit_Extension-Swift.h
I was able to figure out the answer by editing the Objective-C Generated Interface Header Name field in the extension's build settings. I had never previously edited this field, and I'm not sure how the value was removed. I'll leave this here in case others have the same problem:

Resources