2

SOLVED: See bottom of post

I'm trying to practice with OAuth 2.0 and Swift, with the end goal of achieving an app that can get stats from Fitbit API.

I've found a lot of outdated tutorials (that don't use OAuth 2.0), but I did manage to find this sample code that has Fitbit specific code:

https://github.com/caroline6927/QuickStartApp

I downloaded it and opened the app in Xcode, and my first red flag was that the frameworks were all red. I did research on this, but no information I found was able to solve the issue. (solutions mainly consisted of trying to change the location to 'relative to SDK' or other paths)

The second issue I ran into was an error :

No such module 'Alamofire'

I looked in the project files and found Alamofire, but only as swift files. So I downloaded Alamofire, and inserted the .xcodeproj file into the project. That eliminated the Alamofire error, but then I received the following error:

No such module 'SwiftyJSON'

So I did the same thing, downloaded it and inserted the .xcodeproj file into the project. This all felt very...wrong...as I thought the original project I downloaded from Github should contain all these files, so I was wondering if the red framework files had anything to do with this.

So after inserting the Alamofire and SwiftyJSON files into the project, both of those errors went away, but then I got a new error:

Use of unresolved identifier 'UIApplication'

And I can't shortcut my way around this error. I would really appreciate any help with this issue. Pulling my hair out over this.

I tried user:chasenyc's pod install idea, and they successfully installed, but were also accompanied by the following messages:

Analyzing dependencies

Downloading dependencies

Using Alamofire (4.0.0)

Using SwiftyJSON (3.0.0)

Generating Pods project

Integrating client project

Sending stats

Pod installation complete! There are 2 dependencies from the Podfile and 2 total >pods installed.

[!] Automatically assigning platform ios with version 9.3 on target QuickStartApp >because no platform was specified. Please specify a platform for this target in >your Podfile. See https://guides.cocoapods.org/syntax/podfile.html#platform.

[!] The QuickStartApp [Debug] target overrides the >ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES build setting defined in Pods/Target >Support Files/Pods-QuickStartApp/Pods-QuickStartApp.debug.xcconfig'. This can >lead to problems with the CocoaPods installation - Use the$(inherited)` flag, or - Remove the build settings from the target.

[!] The QuickStartApp [Release] target overrides the >ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES build setting defined in Pods/Target >Support Files/Pods-QuickStartApp/Pods-QuickStartApp.release.xcconfig'. This can >lead to problems with the CocoaPods installation - Use the$(inherited)` flag, or - Remove the build settings from the target.

UPDATE

I was able to eliminate the messages from pod install by following these instructions: https://github.com/CocoaPods/CocoaPods/issues/5981

Xcode error remains.

SOLVED: In case anyone else stumbles upon this post, I solved the error by working on the .xcworkspace file instead of the .xcodeproj file.

Max
  • 21
  • 4
  • sounds like you need to look into cocoapods and after installing, run `pod install` in terminal in project folder. – Alex Harris May 10 '17 at 21:46
  • I attempted it and the pods successfully installed, but I also got a few messages along with it. But after installing pods, and making sure they had the right target, they didn't appear in the target dependencies in the xcode (although maybe they're not supposed to). Errors still present after pod install. Thanks for the reply, I really appreciate it. Much less information on OAuth 2.0 with swift than I was expecting. – Max May 11 '17 at 02:54
  • I would try a new question with whatever errors you are encountering. Hope this helps you get in the right direction! – Alex Harris May 11 '17 at 02:56

0 Answers0