Use leveldb-library.framework from firebase for iOS with Xcode9 - objective-c

I would like to be able to use the leveldb-library.framework that google is shipping with their firebase iOS SDK. I don't seem to be able to import the framework.
What I did:
1: copy leveldb-library.framework to project dir
2: in Xcode > Target > Linked Frameworks and Libraries [+] add the framework
3: make sure the header search path it set correctly
4: add a Objective-C++ wrapper class and import the leveldb headers
Getting a linker error:
/Users/ronny/projects/clients/internal/TestCD/TestCD/LevelDB.mm:11:9: fatal error: 'leveldb/db.h' file not found
#import "leveldb/db.h"
^~~~~~~~~~~~~~
1 error generated.
The Headers directory in the framework provides all the headers: db.h, options.h but without the "leveldb" parent directory.
Changing the imports to the following throws the same error:
#import <leveldb/db.h>
#import <leveldb/options.h>
Once I change the imports to this:
#import <leveldb-library/db.h>
#import <leveldb-library/options.h>
the linker is able to find the includes but throws another error:
In file included from /Users/ronny/projects/clients/internal/TestCD/TestCD/LevelDB.mm:11:
/Users/ronny/projects/clients/internal/TestCD/leveldb-library.framework/Headers/db.h:10:10: fatal error: 'leveldb/iterator.h' file not found
#include "leveldb/iterator.h"
^~~~~~~~~~~~~~~~~~~~
1 error generated.
At this point I am no longer sure what can be done in order to resolve this. Adding the import path doesn't help either. Xcode completes the import as such:
Any pointers towards solving this would be greatly appreciated. The project can be found here: https://github.com/ronnyf/TestCD

The framework expects to be called leveldb, but your example calls it leveldb-library.
mv leveldb-library.framework leveldb.framework
mv leveldb.framework/leveldb-library leveldb.framework/leveldb
Update the Xcode project with the renamed framework and it successfully builds.

Related

Xcode 11 debugger crashes on breakpoint, can't find Foundation.h

My macOS app compiles and runs fine, but since switching to Xcode 11, I can no longer debug from breakpoints. The debugger always crashes with a bunch of messages like this:
warning: Swift error in scratch context: /foobar/Foo-Bridging-Header.h:14:9: note: in file included from /foobar/Foo-Bridging-Header.h:14:
#import "TPPreciseTimer.h"
^
error: /foobar/Timer/TPPreciseTimer.h:9:9: error: 'Foundation/Foundation.h' file not found
#import <Foundation/Foundation.h>
^
/foobar/Timer/TPPreciseTimer.h:9:9: note: did not find header 'Foundation.h' in framework 'Foundation' (loaded from '/System/Library/Frameworks')
#import <Foundation/Foundation.h>
^
error: failed to import bridging header '/foobar/Foo-Bridging-Header.h'
.
Shared Swift state for Foo has developed fatal errors and is being discarded.
REPL definitions and persistent names/types will be lost.
Message from debugger: The LLDB RPC server has crashed. The crash log is located in ~/Library/Logs/DiagnosticReports and has a prefix 'lldb-rpc-server'. Please file a bug and attach the most recent crash log.
Anyone know a workaround for something like this?
My coworkers still on Xcode 10.3 are not having this issue with the same codebase.
Same here. Removing /Users/{user}/Library/Developer/Xcode/DerivedData directory helped.

Cannot import IQKeyboardManager in Objective-C project

I installed, IQKeyboardManager with pod. using this line:
pod 'IQKeyboardManager'
Then I wanted to import it in a view controller:
In view controller .m file (I tested both of import lines):
1. #import "IQKeyboardManager.h" ----> clang: error: linker command failed with exit code 1 (use -v to see invocation)
2. #import IQKeyboardManager; ----> Module 'IQKeyboardManager' not found
IQKeyboardManager (Objective-C):- Just drag and drop IQKeyBoardManager directory from demo project to your project. That's it.
it does not require any additional setups in Objective c.
Just Drag and drop.
if you want call any method of IQKeyboardManager then direct call static methods.
[IQKeyboardManager methodName];
I think you need to import like this
#import <IQKeyboardManager/IQKeyboardManager.h>

UI Testing xCode 7.3 - Cannot print variables (i.e 'po app') in the console: (could not build Objective-C module 'Bolts')

I have UI testing project set up and was working perfectly in xCode 7.2. Since I upgraded to xCode 7.3 I cannot print any variables in the console. I set breakpoints in both Application (main project) and UI Test, 'po' command works in the main project but as soon as it reaches UI testing the 'po' command stop working. I have tried almost all the solutions I could find on the internet but still no luck. It complains about the Objective-C module 'Bolts' that I am not using at all in UI testing. Below is how the error message looks like:
(lldb) po app
error: Error in auto-import:
failed to get module 'MyUITestProject' from AST context:
<module-includes>:1:9: note: in file included from <module-includes>:1:
#import "Headers/Bolts-umbrella.h"
^
/Users/../Pods/Target Support Files/Bolts/Bolts-umbrella.h:7:9: note: in file included from /Users/../Pods/Target Support Files/Bolts/Bolts- umbrella.h:7:
#import "BFAppLinkReturnToRefererController.h"
^
/Users/../Pods/Bolts/Bolts/iOS/BFAppLinkReturnToRefererController.h:14:9: error: include of non-modular header inside framework module 'Bolts.BFAppLinkReturnToRefererController'
#import <Bolts/BFAppLinkReturnToRefererView.h>
...
...
Is there anyone run into the same issue? Does anyone knows what cause this failure and any advice?
Delete:
/Users/{User}/Library/Developer/Xcode/DerivedData
and then restart your Xcode.

Cocoapod fails to build on Travis-CI - "expected a type"

Objective: Build a cocoapod with CI support through travis-ci and coveralls.
Sub Objective: Keep git repo cleared of Pods/, while still including Podfile and Podfile.lock
Referenced repo: SRRandomUser
note: while indeed there exists a simple workaround solution (just removing Pod/ from my .gitignore, I ask this question because it will likely be helpful to understand this issue for future work.
Here is the situation I find myself in:
Using FSNetworking for network requests.
One of its classes, FSNData, has a class method withImage:jpegQuality:fileName: that accepts a UIImage and CGFloat as parameters.
Building this file without adding #import for UIKit and CoreGraphics results in a compiler error of expected a type with reference to the UIImage and CGFloat parameters
Locally, this is not a problem because I can add the module #imports, however since I am not committing the entirety of the Pods/ directory, these changes don't get pushed
Travis received the build and attempts to build, but since the FSNData doesn't have CoreGraphics or UIKit imported, when Travis goes to build the project, it throws the error in SRRandomUserGenerator since that class is #importing the affected FSNData class:
✗ Compile SRRandomUserGenerator.m (73 ms)
In file included from /Users/travis/build/spacedrabbit/SRRandomUser/Random Strangers/SRRandomUser/SRRandomUser/SRRandomUserAPIManager.h:10:
In file included from /Users/travis/build/spacedrabbit/SRRandomUser/Random Strangers/SRRandomUser/../../Pods/Headers/Public/FSNetworking/FSNConnection.h:36:
/Users/travis/build/spacedrabbit/SRRandomUser/Random Strangers/SRRandomUser/../../Pods/Headers/Public/FSNetworking/FSNData.h:42:18: error: expected a type
+ (id)withImage:(UIImage*)image jpegQuality:(CGFloat)quality fileName:(NSString*)fileName;
^
/Users/travis/build/spacedrabbit/SRRandomUser/Random Strangers/SRRandomUser/../../Pods/Headers/Public/FSNetworking/FSNData.h:42:46: error: expected a type
+ (id)withImage:(UIImage*)image jpegQuality:(CGFloat)quality fileName: (NSString*)fileName;
^
2 errors generated.
So, my questions are:
How do I either silence that warning so that the build runs anyhow or
How do I get that Pod to include the correct frameworks for building?
Many thanks in advance, SO.
I would recommend trying to search for the framework you need via Cocoapods.org. If you're using Cocoapods it usually means that it's been linked to your project (so there's really no way to silence the error, especially in this case where it seems that the framework you're using depends on other frameworks)

Connecting HTTPKit to a Theos application project. Undefined symbols error

Aim
I am trying to build the simplest Theos application that is acting like HTTP server.
I have no specific preferences on what libraries to use, but I tried by best using HTTPKit this time. I will appreciate any comments and/or links on how to build such applications.
Question in a couple of words
Failed to use HTTPKit in Theos application project. Getting "Undefined symbols" when using any of the HTTPKit classes.
Personal thoughts
I am sure the "Undefined symbols" error is caused by wrong linking. And I am almost sure that it has to do something with the dependencies folder since I have no idea where to put it and how to link it.
It's not completely neccessary to use HTTPKit, but I am having quite the same troubles trying to implement CocoaHTTPServer in Theos application.
I will also appreciate any comments on what I am doing wrong while installing Theos and making applications.
How I installed and configured Theos
Installed Theos using the following guide
Downloaded everything from one of the headers repository into
$(THEOS)/include
Downloaded (additionally) IOSurfaceAPI.h from here into
$(THEOS)/include/IOSurface
Making a simple project
1.Created a Theos application using NIC
cd ~
$THEOS/bin/nic.pl
NIC 2.0 - New Instance Creator
------------------------------
[1.] iphone/application
[2.] iphone/library
[3.] iphone/preference_bundle
[4.] iphone/tool
[5.] iphone/tweak
Choose a Template (required): 1
Project Name (required): name
Package Name [com.yourcompany.name]:
Author/Maintainer Name [***]:
Instantiating iphone/application in name/...
Done.
2.Put the whole repository HTTPKit into newly created folder
~/name/HTTPSources
3.Added the following line
name_FILES += $(foreach ext, c cpp m mm x xm xi xmi, $(wildcard
HTTPSources/*.$(ext)))
into the Makefile, so it looks like this
4.Put all files from here into newly created
$THEOS/include/HTTPKit
5.Now the $(THEOS) folder looks like this
6.Calling make now doesnot cause fatal errors (except ldid command, which I guess is not vital) resulting in
~/name/theos/makefiles/targets/Darwin/iphone.mk:41: Deploying to iOS 3.0 while building for 6.0 will generate armv7-only binaries.
Making all for application name...
Copying resource directories into the application wrapper...
Compiling main.m...
Compiling nameApplication.mm...
Compiling RootViewController.mm...
Linking application name...
Stripping name...
Signing name...
/bin/sh: ldid: command not found
Trying to use HTTPKit, getting errors
1.Added HTTPKit import and a few simple lines from the example
HTTPServer * serv = [[HTTPServer alloc] init];
[serv handleGET:#"/hello/*"
with:^(HTTPConnection *connection, NSString *name) {
return [NSString stringWithFormat:#"Hello %#!", name];
}];
into ~/name/main.m so it looks like this
2.Now calling make causes "Undefined symbols for architecture armv7" error
~/name/theos/makefiles/targets/Darwin/iphone.mk:41: Deploying to iOS 3.0 while building for 6.0 will generate armv7-only binaries.
Making all for application name...
Copying resource directories into the application wrapper...
Compiling main.m...
Linking application name...
Undefined symbols for architecture armv7:
"_OBJC_CLASS_$_HTTPServer", referenced from:
objc-class-ref in main.m.f3071598.o
ld: symbol(s) not found for architecture armv7
clang: error: linker command failed with exit code 1 (use -v to see invocation)
make[2]: *** [obj/name.app/name.ba964c90.unsigned] Error 1
make[1]: *** [internal-application-all_] Error 2
make: *** [name.all.application.variables] Error 2
Additional info
find ~/name
make clean all messages=yes
Try adding
export ARCHS = armv7 arm64
export TARGET = iphone:clang:7.0:7.0
to your makefile.
That fixed a similar error for me. If the error is different would you be so kind as to post the output?
I think you missing library. You only have HTTPServer header but lack of implement. Compile HTTPKit and put it on $THEOS/lib. Then add name_LIBRARIES = nameoflibHTTKit in Makefile