You must add a shared scheme in AppCenter - ios

I wish to setup AppCenter BuildConfiguration for my GitLab iOS xCode Project.
I get the following error saying that I must add a shared scheme:
I follow the steps here to generate a scheme for my workspace: https://learn.microsoft.com/en-us/appcenter/build/troubleshooting/ios#no-scheme
The final step says: Add the .xcscheme file to source control and pushed to your remote repository so that App Center can access it.
Question:
Where is this .xcscheme file located whenever it is generated as I cant seem to find it?
What folder etc should it be in?

Try to share it here, in the "scheme editor". Then see if it shows up in our version control.
Else, apply any change to your scheme, you should then see file changes in your version control like this. Make sure that the file type is not added to your ignore list (e.g. git ignore).

Related

Could not locate configuration file GoogleService-Info.plist when using FirebaseApp.configure(options:)

In my project I have different targets for the same app with different configurations (Production / Staging / QA). As suggested by the Firebase docs I added a plist file for each trarget and initializing FirebaseApp by passing the correct configuration file in this way:
let configPath = Bundle.main.path(forResource: NAME_OF_PLIST_FOR_CURRENT_TARGET ofType: ".plist")!
let options = FirebaseOptions(contentsOfFile: configPath)!
FirebaseApp.configure(options: options)
I also removed from my project the GoogleService-Info.plist file as suggested in docs here to ensure reliable Analytics reports.
When I run the app in the console I see these messages.
[Firebase/Core][I-COR000012] Could not locate configuration file: 'GoogleService-Info.plist'.
[Firebase/Analytics][I-ACS020006] Google App ID from GoogleService-Info.plist is empty. Please, define GOOGLE_APP_ID in GoogleService-Info.plist for Analytics to work reliably. See
[Firebase/Analytics][I-ACS025020] Analytics requires Google App ID from GoogleService-Info.plist. Your data may be lost. Google App ID has been changed. Original, new ID: (nil), MYAPPID
Am I doing something wrong? Could this configuration lead to lost Analytics? (as console message suggest)
After several attempts it seemed that, despite the error messages in the console, Firebase was configured correctly.
Nonetheless I decided to adopt the solution proposed by #Micgal, thus having multiple files named GoogleService-Info.plist in separate filesystem directories and adding each one to the corresponding target. I can then initialize Firebase with FirebaseApp.configure() which works as expected without generating error messages.
Alternative workaround to having separate folders for GoogleService-Info.plist is adding additional step in Build Phases, to copy appropriate file. Just go to Targets / Build Phases and add new script by clicking on "New Run Script Phase". Script could be something like:
cp "${SRCROOT}/${PROJECT}/${FIREBASE_CONFIG_FILE}.plist" "${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/GoogleService-Info.plist"
where FIREBASE_CONFIG_FILE is defined in Build Settings as User-Defined settings which has different values for various configurations. And then just calling FirebaseApp.configure().
There is also a dedicated ticket on Firebase github
maybe you have to add this needed file (GoogleService-Info.plist) to you project ressources. Open yourproject.xcworkspace in Xcode and in the Project navigator click right on Ressources folder and select 'Add files to...'.
Select the GoogleService-Info.plist in the left pane, then uncheck/recheck the Target Membership checkbox for your project.
When you use flutter:
I ran the flutter cli to add Firebase to my project, using the flutterfire configure command. This added the GoogleService_Info.plist to my project, but didn't register the file in the .xcworpspace file.
So I had to right-click on the Runner-folder in Xcode, choose Add Files to "Runner"..., and select the file GoogleService_Info.plist

How to modify plugins Dart code Flutter?

I am developing a Flutter app, and it uses map_view plugin. I want to add new functionalities to the plugin by modifying the source code. How do I find the actual source code of the plugin in my project after installing it through Flutter?
How plugin is added in Flutter
The dependency for map_view plugin is added to pubspec.yaml as below, then running flutter packages get will add it to the project.
dev_dependecies:
map_view:
Here is step by step of how to modify plugin locally, my plugin named: flutter_abc-0.4.1
Right click on package/plugin's import file name, choose Reveal in Finder
Or hold CMD + Click on that file name to go to that file, then Right click anywhere in the file and choose "Reveal in Finder".
Normally it's located at ~/.pub-cache/hosted/pub.dartlang.org/flutter_abc-0.4.1
Copy whole package folder to your app folder
For easy hijacking files, just copy all to your app folder (same level with pubspec.yaml, not in the lib folder), then renaming version:
For example: flutter_abc-0.4.1-hijacking
Now you can modify whatever you want to fix bug locally.
Modify pubspec.yaml to point to local package
Open your project pubspec.yaml
Change path of dependencies to, for example:
flutter_abc: path: ./flutter_abcd-0.4.1-hijacking/
The most elegant way is to fork a repo, do all changes you need and commit them to your fork of the repo. After that you just need to add forked repo from git as a dependency in pubspec.yaml file.
With the git reposity of the desired plugin here
Clone it.
Make your modification
Submit a pull request.
And done
We usually use packages by importing them in the files where we need them.
To modify a plugin, you need to Ctrl + click on the import line (for e.g. import 'package:dio/dio.dart';) ctrl + clicking on this line will open the source code for this plugin. You can edit the code there.
Remember, the change won't be permanent and if you push your code to git and then clone it later, the changes you've done will be reverted to the original.
So to avoid this, you can just copy all the source code and make a separate dart file and copy and modify all the code there to play safe.
It's worth stating that for quick testing / debugging, you can actually modify the code directly in your .pub-cache, e.g. .pub-cache/hosted/pub.dartlang.org/video_player-2.3.0/lib/video_player.dart. For it to take effect, you must fully restart your app, a hot reload won't work.

File missing error iOS Xcode

I have a sample project with multiple schemes.I am new to such a project.
I want to know How When and Where do we use such a flow(multiple projects in a single project).
See the image below,I am getting a file missing error while I try to build the project.But I don't know why I am getting such an error.The file that says is missing is already there in the project folder.
What am i doing wrong?I have added the three schemes by directly clicking +addfiles button to "my project " button at the bottom of the navigation pane.
the error is : "HTTPConnection.h file is missing."
Concerning your first question....
Sub-projects inside a project are useful if they build something (a library, usually) that your main project depends on. If the library is under development at the same time as the application, you may want to build it from source as a dependency rather than pre-building it and managing the installation of it as a binary file.
As for the missing file problem, including it in the project (or sub-project) doesn't automatically make it visible if it's not also in the source directory. In that case, it needs to be added to the project's header search paths.

Xcode iOS project, how to store dev user/pass without putting in version control

We develop an ecommerce app. For convenience when developing, we want to automatically populate the username & password that corresponds to whatever account we prefer on our ecom servers.
The best solution I could come up with so far is:
When debug mode is active, get the username and password from a plist file called debug-credential.plist.
To avoid checking this into git I have to put this file in gitignore.
I also have to add this to the Xcode project navigator so that the framework can find this file when I look for it in the bundle.
So, the problem is, I want this file to be optional. If it's not there, and my app can't find it, just don't populate the password.
No problem, except that the project file I have committed is expecting the debug-credential.plist file and can't find it, therefore won't compile. It would be fine to have the plist file with empty fields checked-in except when the dev wants to specify their own ecom credentials, then git will want to check this in.
Basically I want a way to have a local file, ignored by git, where I can put optional params for my app, and have it so that if a dev checks out a fresh clone, and does not create that file, the app will still run, but just won't have access to the parameters.
Thanks!
I also have to add this to the Xcode project navigator so that the
framework can find this file when I look for it in the bundle.
You don't have to, instead add a shell script to Build Phases to copy files from anywhere to the app bundle, e.g.
ditto -V ./Secret/ "$TARGET_BUILD_DIR/$UNLOCALIZED_RESOURCES_FOLDER_PATH"

Xcode has started making archives, not apps. How do I change it back?

Im' writing an phone app in Xcode 4.2. At some point in the last few days, I changed something - I don't know what, and there's nothing obvious in the git history - and although I can still run it on my device and in the simulator, when I archive the build it makes an archive instead of an app. I can't share these archives as IPA files; if I try I get told "No packager exists for this type of archive".
What did I do? How do I change it back so I can produce IPAs again?
I did the following to make it work for me:
for the three20 static library, I used cocoapods to include the files within the main project.. it just got rid of all the trouble three20 was giving me (and they are lots..) btw i tried replacing three20 with Nimbus.. but Nimbus was lacking on some of the features that my project was using three20 for.. so Nimbus wasn't helpful.
set skip install to yes under build settings for all other sub projects/static libraries and switched the copy headers from public to project under build phases
most importantly: under the sub libraries.. under build phases i ensured that copy files destination was changed from Absolute path to products directory.
and that was it!
hint: to get an idea of the offending files that's causing your archive to create an archive file rather than an ipa do this:
Select the archive and click the Distribute button.
Select the 'Save Built Products' option.
Hit Next and Save.
Browse the created directory in Finder.
The 'libraries' subdirectory will identify the libraries that you need to set the Skip Install to Yes.
in some cases usr/local/include will identify the culprit header files you need to move from Public to Project or the files that you have to change from absolute path to products directory. but that directory (ie usr/local/include) varies depending on your sublibrary directory structure
Make sure for any intermediate targets you select "Skip Install" for its build settings.
Click ont the build dropdown in the top-right of your Xcode window and select "edit scheme" and see if anything is wrong there.
If you can't see anything, try selecting "manage schemes" then delete your old schemes and press "autocreate schemes now" to make a new one.
You only want one scheme, for your app build (or one for each target if there are multiple targets). If there are other schemes (e.g. for embedded sub projects used to create static libraries used by your project) delete them.
Also, as jrtc27 says, if you have got any sub-projects that produce static libs, you need to mark them as "skip install" in the build settings. There's another question here that relates specifically to that issue and has a more detailed explanation of how to fix it:

Resources