# Troubleshooting

The following error messages can be output from the Xcode source editor extension:

| Error                                                                   | Fix                                                                                                                                                                                                                                                                 |
| ----------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| File type must be either `Objective-C Source` or `Swift Source`         | The Xcode source editor extension supports Objective-C .m and Swift .swift source files. Ensure the `Type` of the source file in Xcode's `Identity and Type` inspector is either `Default - Objective-C Source` or `Default - Swift Source`.                        |
| An internal error occurred                                              | Most likely the result of the regular expression parsing routines failing. Please file an [Issue](https://github.com/electricbolt/appfiguratesdk/issues).                                                                                                           |
| `#elif TARGET_OS_WATCH` missing in publicKey method                     | You have `#if TARGET_OS_IOS` in your Objective-C source file, but the corresponding `#elif TARGET_OS_WATCH` was not found.                                                                                                                                          |
| `#elseif os(watchOS)` missing in publicKey method                       | You have `#if os(iOS)` in your Swift source file, but the corresponding `#elseif os(watchOS)` was not found.                                                                                                                                                        |
| `#endif` missing in publicKey method                                    | You have `#if TARGET_OS_IOS` and `#elif TARGET_OS_WATCH` in your Objective-C source file, but the corresponding `#endif` was not found OR you have `#if os(iOS)` and `#elseif os(watchOS)` in your Swift source file, but the corresponding `#endif` was not found. |
| No `ENCRYPTED_STRING` or `ENCRYPTED_STRING_IOS_WATCHOS` macros found    | The source file does not have any `ENCRYPTED_STRING` or `ENCRYPTED_STRING_IOS_WATCHOS` macros. Ensure you have at least 1 macro specified.                                                                                                                          |
| Both `ENCRYPTED_STRING` and `ENCRYPTED_STRING_IOS_WATCHOS` macros found | The source file has both types of `ENCRYPTED_STRING` or `ENCRYPTED_STRING_IOS_WATCHOS` macros. You may specify `ENCRYPTED_STRING` or `ENCRYPTED_STRING_IOS_WATCHOS` in your source file but not both.                                                               |
| No return statement found                                               | When parsing the `publicKey` method, for either the iOS (or watchOS) public key, the `return` statement was not found.                                                                                                                                              |
| Could not parse public key, MIIB prefix not found                       | Public key strings always start with the prefix `MIIB`. Ensure your public key string is output from the Appfigurate (Simulator or App Store) app unchanged.                                                                                                        |
| Could not parse public key, base64 decoding failed                      | The public key that was parsed could not be decoded. Ensure your public key string is output from the Appfigurate (Simulator or App Store) app unchanged.                                                                                                           |
| publicKey method not found                                              | The `- (NSString*) publicKey` method was not found. Ensure the signature of the `publicKey` method is correctly specified.                                                                                                                                          |
| publicKey method incomplete                                             | The `publicKey` method doesn't appear to be complete. Ensure you've added no additional logic or multi line comments to the method from what is output from the Appfigurate (Simulator or App Store) app.                                                           |
| publicKey method missing }                                              | Could not find the closing brace `}` of the `publicKey` method. Ensure you've added no additional logic or multi line comments to the method from what is output from the Appfigurate (Simulator or App Store) app.                                                 |

<br>
