Guide to setting up a Swift project


#22

@agnomen Thank you for this answer.

I took a look and It worked. Actually I didn’t change the header search path. I just copy past the structure.framework at the same level as the .xcodeproj file.

Thank you for your help !


#23

I’m a noob developer so this tutorial was a huge help, thanks! Are there any resources you can point me to to access the unbounded tracking information? I’m interested in accessing the Structure’s translation X,Y,Z and rotation X,Y,Z values from the unbounded tracking but not sure what I may need to add to this swift project to get access to that information. Simply printing those values would be a win and I can manipulate the information from there.

Thanks!


#24

@david_derwin the best resource is the UnboundedTracker sample in the SDK Samples directory.

-jim


#25

Getting Errors:

Undefined symbols for architecture arm64:
OBJC_CLASS$_AVCaptureDevice”, referenced from:
objc-class-ref in Structure
“_CMGetAttachment”, referenced from:
l2819 in Structure
“_CMTimeMake”, referenced from:
l1952 in Structure
“_CMVideoFormatDescriptionCreateForImageBuffer”, referenced from:
l1596 in Structure
l1952 in Structure
“_CMSampleBufferCreateForImageBuffer”, referenced from:
l1596 in Structure
l1952 in Structure
“_CMTimeGetSeconds”, referenced from:
l385 in Structure
l393 in Structure
l1532 in Structure
l1592 in Structure
l1952 in Structure
l2996 in Structure
“_kCMTimeInvalid”, referenced from:
l1952 in Structure
“_CMCopyDictionaryOfAttachments”, referenced from:
l1592 in Structure
“_CMSampleBufferGetSampleTimingInfo”, referenced from:
l1596 in Structure
“_CMSampleBufferGetPresentationTimeStamp”, referenced from:
l385 in Structure
l393 in Structure
l1592 in Structure
l1952 in Structure
l2996 in Structure
“_CMTimeCompare”, referenced from:
l1532 in Structure
“_CMVideoFormatDescriptionGetDimensions”, referenced from:
l1532 in Structure
“_AVMediaTypeVideo”, referenced from:
l1531 in Structure
“_CMSampleBufferGetImageBuffer”, referenced from:
l115 in Structure
l1463 in Structure
l1464 in Structure
l1503 in Structure
l1504 in Structure
l1505 in Structure
l1594 in Structure

ld: symbol(s) not found for architecture arm64
clang: error: linker command failed with exit code 1 (use -v to see invocation)


#26

Looks like you are missing the External Accessory Framework


#27

i have that added as well as the others:


#28

I had similar problems at one point when migrating projects when the new iOS versions came out, the fix was that some of the $(inherited) build settings were missing after migration. For more details see: http://stackoverflow.com/questions/19213782/undefined-symbols-for-architecture-arm64

Best of luck!


#29

Thanks, I tried adding $(inherited) but still getting the same 15 errors. Also, when I try to add STSensorControllerDelegate to my swift class (step 9) Xcode does not recognize it. I’m wondering if some other file isn’t getting recognized?

As a side note: Your GitHub project works great when I download it and run it so I’m really confused why i’m getting errors even after doing steps 1-8 and building without attempting any functionality?


#30

I just went through the steps 1-9 again, but other than needing to use zlib.tbd instead of dynlib I didn’t have any issues.

I also tried building a watch and a tv application to see if that was the problem. I encountered no issues creating a watch application up to step 8, but with the tvOS application it wasn’t possible to add the external accessory framework, so I don’t think that was the problem.

Finally I tried skipping various steps. I don’t get exactly the same thing, but if I comment out everything in the bridging header, I do get some linker errors like the ones you have.

So check if you have actually got the bridging header (usually something like projectname-Bridging-Header.h in your project, and it is referenced by the build setting “Objective C Bridging Header” and it contains the lines:

#define HAS_LIBCXX
#import "Structure.h"
#import "StructureSLAM.h"

Hope that helps.


#31

how do i add the zlib.tdb? did you mean libz.tbd?


#32

Sorry yes that was a typo.

The dynlib version works fine too, the tbd is just a wrapper that xcode uses now and so it doesn’t list the dynlib version for me any more on the “Choose framework libraries to add” dialog.


#33

started completely over and added everything to the root directory and it worked. Nothing different from before except a lack of file organization. very strange.

Also, one thing you don’t have listed up top is that you have to set “Enable Bitcode = No” under Build Settings. This is set to No in your GitHub project as well.


#34

I was wondering if someone can help.

I have been following this Structure/Swift instructions to a T, but I am getting the following errors and I am not sure how to fix it.

Any help would be appreciated.

Thanks

Stan


Ld /Users/staque/Development/GitHub/SEAR-RL/BUILDS/SEARRL-XCODE-WORKSPACE/Build/Products/Debug-iphoneos/SEAR-RL.app/SEAR-RL normal arm64
    cd /Users/staque/Development/GitHub/SEAR-RL/SEAR-RL
    export IPHONEOS_DEPLOYMENT_TARGET=9.3
    export PATH="/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/usr/bin:/Applications/Xcode.app/Contents/Developer/usr/bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin"
    /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang -arch arm64 -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS9.3.sdk -L/Users/staque/Development/GitHub/SEAR-RL/BUILDS/SEARRL-XCODE-WORKSPACE/Build/Products/Debug-iphoneos -F/Users/staque/Development/GitHub/SEAR-RL/BUILDS/SEARRL-XCODE-WORKSPACE/Build/Products/Debug-iphoneos -F/Users/staque/Development/GitHub/SEAR-RL/SEAR-RL -filelist /Users/staque/Development/GitHub/SEAR-RL/BUILDS/SEARRL-XCODE-WORKSPACE/Build/Intermediates/SEAR-RL.build/Debug-iphoneos/SEAR-RL.build/Objects-normal/arm64/SEAR-RL.LinkFileList -Xlinker -rpath -Xlinker @executable_path/Frameworks -miphoneos-version-min=9.3 -dead_strip -Xlinker -no_deduplicate -fembed-bitcode-marker -lc++ -L/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphoneos -Xlinker -add_ast_path -Xlinker /Users/staque/Development/GitHub/SEAR-RL/BUILDS/SEARRL-XCODE-WORKSPACE/Build/Intermediates/SEAR-RL.build/Debug-iphoneos/SEAR-RL.build/Objects-normal/arm64/SEAR_RL.swiftmodule -framework Accelerate -framework ImageIO -framework ExternalAccessory -lz.1 -framework Structure -Xlinker -dependency_info -Xlinker /Users/staque/Development/GitHub/SEAR-RL/BUILDS/SEARRL-XCODE-WORKSPACE/Build/Intermediates/SEAR-RL.build/Debug-iphoneos/SEAR-RL.build/Objects-normal/arm64/SEAR-RL_dependency_info.dat -o /Users/staque/Development/GitHub/SEAR-RL/BUILDS/SEARRL-XCODE-WORKSPACE/Build/Products/Debug-iphoneos/SEAR-RL.app/SEAR-RL

ld: '/Users/staque/Development/GitHub/SEAR-RL/SEAR-RL/Structure.framework/Structure' does not contain bitcode. You must rebuild it with bitcode enabled (Xcode setting ENABLE_BITCODE), obtain an updated library from the vendor, or disable bitcode for this target. for architecture arm64
clang: error: linker command failed with exit code 1 (use -v to see invocation)

#35

This looks to be the missing step that timterry73 just mentioned. You need to set ‘Enable Bitcode’ to ‘No’ in the Build Options of the Build Settings tab. The structure SDK doesn’t include bitcode, so you have to turn it off for the build.

I can’t seem to edit the original posted instructions, so sorry about that.


#36

That seems to do the trick! Thanks agnomen!

Stan


#37

Are any developers working on creating a Scanner project in Swift? Getting a working scanner example in swift would be fantastic.


#38

I tried and got as far as I can without some assistance, just posted here:


#41

OK I apologize for the multiple posts, I have tried to delete the invalid ones.

So here is the problem. I upgraded to Xcode 8 beta 5 and let Xcode convert my Swift code to V3.

I did a clean build, and everything seemed fine.

However when I went to build the Test projects I had problems.

I got the the following error.

It seems the Build process can’t find ‘Structure.h’ when it tries to deal with the ‘StructureSLAM.h’ file.

So I am doubly confused now, because everything had to compile Structure.h even before it gets to ‘StructureSLAM.h’.

And Suggestions?

...Tests-Bridging-Header.h:7:9: note: in file included from ...Tests-Bridging-Header.h:7:
#import "StructureSLAM.h"
        ^
.../Structure.framework/Headers/StructureSLAM.h:9:9: error: 'Structure/Structure.h' file not found
#import <Structure/Structure.h>
        ^
<unknown>:0: error: failed to import bridging header '...Tests-Bridging-Header.h'

#42

libz.dylib isn’t shown for iOS 9.3, it’s now libz.tbd.


#43

I just converted to XCode 8 full release, and I think I saw this error come up immediately after converting to Swift 3. I just closed the project and reopened it and it seemed to work. Is it still causing problems for you?