Using AppCode with Flutter plugin - swift

How can I use AppCode for the ios-specific parts of my Flutter plugin?
I've created the plugin with flutter create --template=plugin --platforms=ios myplugin
The command doesn't generate an XCode project or workspace for the plugin itself but it includes an example app for which it does generate these. Running flutter build ios in example then creates symlinks to the plugin code in example/ios/.symlinks that I can use to edit the actual Swift code with auto completion, code navigation etc. When I open these files in AppCode however, I get the below error and no coding assistance is available at all:

I previously used AppCode quite a lot to maintain some Flutter plugins' iOS code (but switched jobs and didn't need AppCode or Xcode). However, I recently started making a free app, and also wanted to contribute to a Flutter plugin for iOS, I wanted AppCode again. I got AppCode working again, so I wanted to share.
In your flutter directory:
For editing/debugging/running Flutter apps' iOS code: run appcode ios
For Flutter plugins, run appcode example/ios (not appcode ios)
Some principles:
The files don't show up immediately, use Command + Shift + O to find your file. Then Opt + F1 to show it in the project navigator.
Built at least once using flutter run or Xcode (to make sure configuration is set up).
You cannot escape Xcode. Xcode and AppCode are complementary. Find the balance 😂🤓. Refactoring code, debugging the application, searching and reading code works really well in AppCode. Xcode does reading configuration better or debugging builds.
If you get random errors (e.g. everything fails but the error is build failed in AppCode, you should open in Xcode or build/run the flutter app for iOS: flutter run and read the error messages.
If you want to debug both Flutter and iOS simultaneously, start the iOS debugger, then "Flutter attach" in android studio (maybe this is possible in VSCode too, but I don't use that).
Here's an example screenshot of AppCode with debugger working. You might be curious if telemetry flag you set in Flutter was actually being set in the iOS side... maybe there's a bug. But I take privacy seriously and confirm the telemetry is disabled. I also watch network traffic sometimes. 😂. If you're interested, you can then follow that to it's dependencies (manually, using by reading package.swift), and find out it is set to true by default.
UserDefaults.standard.register(defaults: [
#keyPath(UserDefaults.MGLMapboxMetricsEnabled): true
])

Related

How do I manually update pubspec.yaml?

I am trying to get dependencies for my pubspec yaml file after I made changes. However, first, I can't even see my IOS Emulator anymore (it seems to have disappeared). I am using MacOS.
Could you please tell me how to update pubspec yaml manually on Android Studio, normally there is a ribbon which shows, but after I made changes, no ribbon has showed up. Also, if you know how to make my IOS emulator (Xcode simulator) show up again, that would be much appreciated. Thanks.
Go to menu bar > Xcode > Open Developer Tool > Simulator

Emulator not running the application

I am trying to setup flutter on my device, so far I have been able to download the flutter SDK and android studio and satisfy the conditions of flutter doctor to start learning android application development:-
flutter doctor
I ignored the absence of visual studio as I don't want my app to be compatible with windows(as I am trying to develop for Android) but I am not able to fix the missing java bundle, any help on how would I do that?
I just ignored it for a second and moved on to set up my emulator but on running, it shows a pop up which says "Attach a debugger or ESC to cancel"(the pop-up is something like this.) how would I fix it.
This doesn't run the app on the emulator so how would I fix that?
Also on trying to debug, it throws this error, I am totally confused on how to proceed further to at least run my app so that I could start developing and learning flutter?
I am following along this to run my application.
Edit:
I have the java bundle in place but don't know how would I configure Android Studio to get it.
java's prescence
Also that the emulator is now showing that the System UI is not responding and on closing it, it further shows this.
It's been a week since I am trying to work out the setup of flutter but some way or the other some issue happens, please help.
Thanks in advance.
you have to install java runtime environment and It'll work. get from here
it'll show like this if you have JDK installed properly.

How to hot reload on both ios and android devices at the same time using IntelliJ IDEA?

I'm using IntelliJ IDEA to code Flutter and usually have 2 simulators running (ios and android). It is kinda annoying when I have to switch the target device manually when I update the code.
Any plugin that can do the trick for IntelliJ IDEA
~As I know, this feature only supported in Visual Studio Code~
Please check https://github.com/flutter/flutter/wiki/Multi-device-debugging-in-VS-Code
Updated Genchi Genbutsu
It possible to do with console commands
Flutter Hot Reload to multiple devices

Flutter / Mac / AndroidStudio / Gradle / appbundle

I finally finished writing my application (Mac + AndroidStudio) and I only have green check on each of my files.
Finally ... I tried to launch the build appbundle by following the guidelines described on the Flutter website.
I have the impression to have done by Google .... I site the result on its search engine: Futter Beautful native apps in record time.
Ok for the beautiful native apps but for the record time ... it's only for writing?
Since I am not a pure coder, I can not build the appbundle. I spend my time doing research on the net and I see that I'm not the only one. Same on Stack Overflow.
Question (to you dear coder friends and possibly to them Google coders): Is there a clean and safe way to generate the appbundle?
(I had less trouble on my first app with xcode at the very beginning of the swift !!!)
Good luck to all. Thanks to Stack Overflow who sharing solutions ....
type flutter build appbundle in terminal in your project directory
sorry.
To precise :
Project flutter built with AndroidStudio on Mac OS Mojave.
All my Flutter files are validated in green in AndroidStudio.
I followed step by step the tutorial Flutter page to deploy my application to build the necessary file to Goole Play Store.
I only use url_launcher and flutter_localizations. The pubspec.yaml is up to date.
My app works great on my smartphone when I launch the app. from AndroidStudio.
Is it common that this is not enough for the launch of the build to be successful?

How to debug into Cordova.framework in xcode

I'm having a problem where cordova is failing to start the camera app on iOS. A simple case works fine, but in my app, not so much.
So I'd like to debug into the Cordova.framework to see what the problem is.
But I can't figure out how to do it. I've built the Cordova project that's sitting next to the installed framework, and I've replaced my framework reference in my project to point at it. That seems to be fine. But I can't step in or set breakpoints.
With the cordova project, i"m building UniversalFramework and it looks like it's set to debug in the scheme config, even though it always builds to release (this seems to be in the script), I see --DDEBUG in the clang output, so I think it's debug. I'm fairly new to xcode so I don't know if it's building a symbol file or how to verify it's a debug framework, etc.
Latest Cordova (2.0.0) has it like a seperate project and linked as static library.
Use that version, you can put breakpoints in the library code.