Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Guide to make it work with Swift #23

Open
ricardo85x opened this issue Nov 18, 2015 · 6 comments
Open

Guide to make it work with Swift #23

ricardo85x opened this issue Nov 18, 2015 · 6 comments

Comments

@ricardo85x
Copy link

I would like to use the DHlibxls, but I have some problem on how to include it in my project.

On README I found this:

Usage: include the enclosed project in your primary Xcode project. Ensure that there is a dependency on it in an Target that uses it. [It does not use categories so no need for "-forceload".]

What you mean with encloused project?
Do you mean only the DHxlsReaderIOS.xcodeproj? or the TestDHlibxls.xcodeproj?
What about the others files and folders?

Thanks

@dhoerl
Copy link
Owner

dhoerl commented Nov 18, 2015

DHxlsReaderIOS - the other project shows a sample use of this project.

@ricardo85x
Copy link
Author

Ok I did follow this guide:

http://stackoverflow.com/questions/9370518/xcode-4-2-how-include-one-project-into-another-one

But I still get this message:

screen shot 2015-11-19 at 10 36 09 am
screen shot 2015-11-19 at 10 35 40 am

Do you know what it could be?

@ricardo85x
Copy link
Author

Ok I did it:
I have to add
#import <Foundation/Foundation.h>
on my bridge header

But

When I try to build I got this:

ld: warning: ignoring file /Users/ricardo/Library/Developer/Xcode/DerivedData/ExcelFinal-btnecoozlgukhpdhbhkymccgggac/Build/Products/Debug-iphoneos/libDHxlsReaderIOS.a, file was built for archive which is not the architecture being linked (arm64): /Users/ricardo/Library/Developer/Xcode/DerivedData/ExcelFinal-btnecoozlgukhpdhbhkymccgggac/Build/Products/Debug-iphoneos/libDHxlsReaderIOS.a
Undefined symbols for architecture arm64:
"OBJC_CLASS$_DHxlsReader", referenced from:
type metadata accessor for __ObjC.DHxlsReader in ViewController.o
ld: symbol(s) not found for architecture arm64
clang: error: linker command failed with exit code 1 (use -v to see invocation)

I am stuck again...

@ricardo85x
Copy link
Author

Ok I did it:
Follow the steps:

1 - Drag the DHxlsReaderIOS.xcodeproj inside you main project
2 - In you Project/Targets go on Targets and add DHxlsReaderIOS as Target Dependencies
3 - In you Project/Targets go on Build Phases and add libDHxlsReaderIOS.a as "Link Binary With Libraries"
4 - In your Project/Targets go on Build Settings and change the "User Header Search Paths" to "/full/path/of/the/DHlibxls/**"
5 - On DHxlsReaderIOS project on Build Phases, remove the libiconv.dylib
6 - On your project/Targets on Build Settings change the "Architectures" to "$(ARCHS_STANDARD_32_BIT)"
7 - On your project/Targets on Build Settings change the "Build Active Architecture Only" to "NO"
8 - On your project/Targets on Build Settings -> Other Linker Flags add: -libiconv and -ObjC
9 - On DHxlsReaderIOS projectc do the same as item 8
10 - Add a bridge header to you project with: "<Foundation/Foundation.h>" and "DHxlsReader.h"

sample swift code:

[code]
let file : String = NSBundle.mainBundle().pathForResource("test", ofType: "xls")!
let reader = DHxlsReader.xlsReaderWithPath(file)
print(reader.appName())
[/code]

Sorry for my english.

@dhoerl
Copy link
Owner

dhoerl commented Nov 20, 2015

Great! So you added the above comment to show that you got it to work?

I just updated the project to support 64 bit and had to deal with issues relating libiconv - see https://forums.developer.apple.com/thread/4572.

So the project is updated to latest Xcode 7.1, and the Test App also works and runs on a 64 bit device in the simulator.

@ricardo85x
Copy link
Author

yes now it is working fine : )

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants