I'm on step 5 of the Using Endpoints in an iOS Client tutorial and when I try to generate all the header and implementation classes for iOS by utilizing the tictactoe-v1-rpc.discovery file it's currently failing with:
"ERROR: Failed to fetch the api description" (see below)
In the terminal I enter:
ConfusedDeer-mbp:/ ConfusedDeer$ /Users/ConfusedDeer/Library/Developer/Xcode/DerivedData/ServiceGenerator-eoemzskhioxhvgbxjfcwxowhamno/Build/Products/Debug/ServiceGenerator \ ~/Desktop/tictactoe-v1-rpc.discovery --outputDir /Users/ConfusedDeer/Desktop/API
Generation Settings:
Output Directory:
~/Desktop/API
Discovery RPC URL: https://www.googleapis.com/rpc?prettyPrint=false
Flags:
Use service name directory: NO
Remove unknown files: NO
Add 'Generated' directory: NO
Allow rootURL overrides: YES
Loading API File(s):
ERROR: Failed to fetch the api description / ~/Desktop/tictactoe-v1-rpc.discovery, error: Error Domain=NSURLErrorDomain Code=-1100 "The requested URL was not found on this server." UserInfo=0x7fec72c2cf30 {NSUnderlyingError=0x7fec72c2c680 "The requested URL was not found on this server.", NSErrorFailingURLStringKey=file:///%20~/Desktop/tictactoe-v1-rpc.discovery, NSErrorFailingURLKey=file:///%20~/Desktop/tictactoe-v1-rpc.discovery, NSLocalizedDescription=The requested URL was not found on this server.}
Generating:
Writing:
ConfusedDeer-mbp:/ ConfusedDeer$
After further troubleshooting I was finally able to generate my iOS client libraries!
The command I used to accomplish this was:
/Users/ConfusedDeer/Library/Developer/Xcode/DerivedData/ServiceGenerator-eoemzskhioxhvgbxjfcwxowhamno/Build/Products/Debug/ServiceGenerator /Users/ConfusedDeer/Desktop/tictactoe-v1-rpc.discovery --outputDir /Users/ConfusedDeer/Desktop/API
There were two issues with the original command I was using. I was finally able to locate the issue by placing:
file:///%20~/Desktop/tictactoe-v1-rpc.discovery
In the browser URL and noticed there was a %20, which is a space. Once I removed all the spaces and the tilde (~) and placed the following in the URL
file:///Users/ConfusedDeer/Desktop/tictactoe-v1-rpc.discovery
once the rpc.discovery file appeared in the browser I realized that the google commmand line tool would be able to locate it. Another issue was the output directory had to be relative (duh!) from where I executed the command in the terminal..
After I ran:
/Users/ConfusedDeer/Library/Developer/Xcode/DerivedData/ServiceGenerator-eoemzskhioxhvgbxjfcwxowhamno/Build/Products/Debug/ServiceGenerator /Users/ConfusedDeer/Desktop/tictactoe-v1-rpc.discovery --outputDir /Users/ConfusedDeer/Desktop/API
in generated the following:
=============================================================================== Generation Settings:
Output Directory: ~/Desktop/API
Discovery RPC URL: https://www.googleapis.com/rpc?prettyPrint=false
Flags:
- Use service name directory: NO
- Remove unknown files: NO
- Add 'Generated' directory: NO
- Allow rootURL overrides: YES Loading API File(s):
- Fetching ~/Desktop/tictactoe-v1-rpc.discovery +-- Loaded: tictactoe:v1 Generating:
- tictactoe(v1) Writing:
- GTLQueryTictactoe.h (1744 bytes) - NEW
- GTLQueryTictactoe.m (1907 bytes) - NEW
- GTLServiceTictactoe.h (1507 bytes) - NEW
- GTLServiceTictactoe.m (1472 bytes) - NEW
- GTLTictactoe.h (583 bytes) - NEW
- GTLTictactoe_Sources.m (702 bytes) - NEW
- GTLTictactoeBoard.h (725 bytes) - NEW
- GTLTictactoeBoard.m (638 bytes) - NEW
- GTLTictactoeConstants.h (663 bytes) - NEW
- GTLTictactoeConstants.m (529 bytes) - NEW
- GTLTictactoeScore.h (974 bytes) - NEW
- GTLTictactoeScore.m (879 bytes) - NEW
- GTLTictactoeScoreCollection.h (976 bytes) - NEW
- GTLTictactoeScoreCollection.m (918 bytes) - NEW
- GTLTictactoeUser.h (878 bytes) - NEW
- GTLTictactoeUser.m (682 bytes) - NE
SUCCESS!