MBProgressHud Swift Compile Error when Archiving - xcode

I already finished my project, it works and runs perfectly on the simulator or in my own device. When I select to Archive the project to upload de build to Itunes Connect, I get all these compile errors
"Use of undeclared type MBProgressHUD"
"Use of unresolved identifier MPProgressHUD"
And so on..
NOTE: I'm using CocoaPods for this library

What solved it for me was adding import MBProgressHUD in the classes where I use this library, not only in the Bridge-Header.h

Navigate to your project build settings and find the “Swift Compiler – Code Generation” section (You may find it faster to type in “Swift Compiler” into the search box to narrow down the results)
Next to “Objective-C Bridging Header” you will need to add the name/path of your header file. If your file resides in your project’s root folder simply put the name of the header file there. Examples: “ProjectName/ProjectName-Bridging-Header.h” or simply “ProjectName-Bridging-Header.h”.
Refer this link http://www.learnswiftonline.com/getting-started/adding-swift-bridging-header/

Welcome to Cocoapods Hell (a.k.a. : where the magic ends), where one must dive into his project build settings and make sense of what went wrong...
It's very hard to answer to you, as any number of reasons might be causing that.
Do you use the same target for Build / Run & Archive ? It might be because your libPods.a isn't copied into your Archive target
Have you installed Pods using pod install , have you tried playing that command again. (yes, faced with magic going wrong, one can sometimes rely on magic to save him again)
'Build' and 'Archive' product often differ in the build configuration they use (Build most of the time uses 'debug' configuration, while Archive uses 'release' configuration... ). Check your Pods configuration files (debug/release) and make sure they both include your MBProgressHud. Also, in your Project 'Info', check which pods Xcode configuration files are selected for 'debug' and 'release'
Good luck !
(PS : as MBProgressHud is a single file, and one you can often change, another solution is to get rid of Cocoapods and just copy/paste it)

Related

Xcode 10, sourcery & swiftlint build phases order

After updating to Xcode 10 there are some issues with initial project configurations. The steps look like this:
Generating some files using Sourcery
Linting with SwiftLint
Build
And configuration works like this:
And this was working fine in Xcode 9, but apparently, it's not working under Xcode 10 build system. The issue is if I download repository (.generated files are not a part of the repository). And hit build it will show me results like:
...
Using configuration file at '.sourcery.yml'
Scanning sources...
Found 239 types.
Loading templates...
Loaded 9 templates.
Generating code...
Finished.
Processing time 0.491948962211609 seconds
...
So sourcery works ok, then linting:
Linting 'FromResponse.generated.swift' (1/186)
Works fine as well as a process, but in the end, build will fail with:
error: Build input files cannot be found:
'/path/Generated/FromResponse.generated.swift',
...
So it's strange since a files are physically there and according to build settings file should be compiled later than generating them. How should I approach sourcery in build process then?
We are able to "fix" this in a similar way as this Github issue:
https://github.com/mac-cain13/R.swift/issues/438#issuecomment-416982928
We have to add each of the generated files by Sourcery to the output folder and it will get picked up by the Xcode correctly.
This relates to changes in the New Xcode Build System that has been enabled by default in Xcode 10. If a build phase creates files which are needed as an input to a later build phase then it needs to specify them explicitly in the Output Files or Output File List.
In your example the Sourcery build phase is generating Swift source file(s) which are needed as input to the Compile Sources phase.
However, the issue at this point is that after you specify the output files for Sourcery, the build phase doesn't re-run every time as it sees the output file is already there. So far I haven't worked out a useable solution to this part, beyond running tools like Sourcery and SwiftGen manually or keeping the generated files in Git so that they are always present.
I was having a similar problem with a buildphase calling mogenerator to build my data model classes. The approach given by #Yuchen should work.
#Andrew: To force always (re-)running this build phase, I add the line
touch .alwaysRun
as the last line in the shell command to run and mark the build phase "Input Files" to have $(SRCROOT)/.alwaysRun. That seems to do the trick.

Issue building CKEditor

I'm on Ubuntu 14.04 and I would like to create a build of CKEditor. I've read: http://docs.ckeditor.com/#!/guide/dev_build.
First issue: I don't have any "build.sh" in my CKEditor folder. Solution: download https://github.com/ckeditor/ckeditor-dev/blob/master/dev/builder/build.sh .
Second issue: the build.sh above is not totaly correct, I had to modify some locations (e.g. "../.." instead of "."). But I think it's now ok since I don't have messages like "file not found" anymore...
Third issue: I've several warnings like:
WARNING: it was impossible to update the lang property in /home/sebsheep/progs_div/albums_tests/ckeditor/release/ckeditor/plugins/youtube/plugin.js
Moreover, I've the impression that CKBuilder only copy my initial folder recursively, as we can see with "/ckeditor/release/ckeditor/release/ckeditor/release/ckeditor/release/ckeditor/release/ckeditor" (thoses files actually are on my disc) on this message:
WARNING: it was impossible to update the lang property in /home/sebsheep/progs_div/albums_tests/ckeditor/release/ckeditor/release/ckeditor/release/ckeditor/release/ckeditor/release/ckeditor/plugins/indent/plugin.js
Those warnings never stop, I have to C-c in order to stop the program.
What am I doing wrong?
I guess that you tried to build CKEditor using a built version which obviously does not contain necessary tools.
To build CKEditor from source:
Clone CKEditor development repository, or just download it if you don't know git.
Add 3rd party plugins to the plugins/ directory.
Modify dev/builder/build-config.js (edit the list of plugins).
Run dev/builder/build.sh

Xcode Archive won't find header file in subproject

So frustrated with XCode right now. I can build and run from code perfectly fine. However, trying to archive is a disaster.
I created a project, then dragged the .xcodeproj into XCode on the project navigator. Shows up fine, cool. Parent project build settings:
Other linker flags: -all_load, -ObjC
Target Dependencies : CocoaLibSpotify (subproject I'm incorporating)
Link Binary with Libraries : libCocoaLibSpotify.a
When I build my project, the following lines work
#import "CocoaLibSpotify.h"
#import <CocoaLibSpotify.h>
However, when I archive, my project fails to find these files. It's worth noting that the subproject files aren't in the same directory as the parent project. However, isn't that the point of the target dependency/link binary with library? Why is it failing to archive? This seems like it should be a lot easier than it's being.
Thanks.
Edit: Errors from compiling
In file included from /Users/ericharmon/Projects/teamsync/teamsync/TeamSync/AppDelegate.m:12:
In file included from /Users/ericharmon/Projects/teamsync/teamsync/TeamSync/Classes/GUI/ViewControllers/LoginViewControll er.h:9:
In file included from /Users/ericharmon/Projects/teamsync/teamsync/TeamSync/Classes/GUI/BaseViewController.h:10:
In file included from /Users/ericharmon/Projects/teamsync/teamsync/TeamSync/Classes/Model/Managers/Managers.h:9:
In file included from /Users/ericharmon/Projects/teamsync/teamsync/TeamSync/Classes/Model/Managers/AppLogicManager.h:11:
In file included from /Users/ericharmon/Projects/teamsync/teamsync/TeamSync/Classes/Model/CoreData/CoreDataObjects.h:13:
/Users/ericharmon/Projects/teamsync/teamsync/TeamSync/Classes/Model/CoreData/Track.h:13:9: fatal error: 'CocoaLibSpotify.h' file not found
#import <CocoaLibSpotify.h>
^
1 error generated.`
Archive uses a different directory structure when building, which can be a pain. I've found success by adding the following to the User Header Search Paths build setting of your application's target:
"$(BUILD_ROOT)/../IntermediateBuildFilesPath/UninstalledProducts/include" (including the quotes).
Also, make sure Always Search User Paths is set to Yes.
In addition, I have $CONFIGURATION_BUILD_DIR/include in my Header Search Paths setting, but I don't think that'll help archiving.

xcode distributing application with 2 project

i have a problem to distributing application with 2 project (one project with sub-project include inside). When i try to make as usual "archive", i'm not able to send application.
Could someone help me?
Regards
I'm guessing the sub-project is a library? And when you do Build > Archive you get an .xcarchive file instead of a .ipa? If so, you need to set the Skip Install flag to No on your library (see this answer), then Build > Archive will generate a .ipa file.
The reason this is happening is because you have two projects.
For the sub-project you need to edit the Target > Build Settings and set the Skip Install setting to Yes.
Afterwards the "Archive" action will work as usual.

OCMock test fails to build: Foundation/Foundation.h : No such file or directory

I am a Xcode beginner, and am facing some problems in compiling an OCMock test. I have added the OCMock.framework in "Groups & Files", and then added a very basic OCMock test from the Unit testing target, basically for Canary testing.
When I compile the OCMockTests.m file, the system returns around 38 errors pointing out all the imported headers that is in OCMock.Framework files to be non-existent, and in the top comes "Foundation/Foundation.h : No such file or directory". But when I compile the OCMock.Framework, then everything succeeds. I tried replacing Foundation.h with NSObject.h, but the system is not even able to find that.
I reckon it is some linker error....the system is somehow probably not able to get the location of Sentest.Framework. BTW, I have updated the Executable info - environment variable - DYLD_FALLBACK_FRAMEWORK_PATH with the correct (?) Sentest framework path (the argument is "-Sentest All"), that is of the IphoneOS folder.
Need your advices...thanks a bunch.
~ Sayan
See Colin Barrett's "OCMock and the iPhone" tutorial.

Resources