Software on Mac
Remote to Mac from Windows with Team Viewer
I'm used to Windows for years and have to use Mac for Xamarin.iOS, and not feeling productive when using Mac. So I use TeamViewer to remote on Mac from Windows even the two machines both on my desk. Here some tips
1. Enable key combination on TeamViewer's menu Actions > send key combinations, thus you can send shortcut key like "Windows Key + S" to save a file in Xamain
2. Cannot find how to send "control dragging" (ctrl + mouse dragging) to create Outlet in XCode, an alternative to "control dragging" is
" instead of control dragging try control clicking on the object you wanted to drag from. The black pop up box that lists the object's outlets etc will appear, and from there you can left-click drag from the circles to wherever you want."
figure: how to create Outlet without control dragging
reference: http://stackoverflow.com/questions/15882149/teamviewer-send-control-key-to-mac-from-windows
Source Control - Git
1. Setup TFS team project with Git source control
2. Configure TFS alternative account in Profile for Git user/password as per this blog
3. If have trouble to clone remote repo with Xamarin Studio, then use XCode to clone
4. How to change Git Version Control username/password in Xamarin Studio for Mac? No, But you can change in the KeyChain app
iOS development
- install XCode
- install Xamarin.ios
- if compiled failed because of info.plist, do the following:
- configure Application Name
- configure Identifier
- configure Version
http://docs.xamarin.com/guides/ios/getting_started/device_provisioning/
1. When using latest SDK to target older verions of iOS device, new api in latest SDK won't work in these old versions. for example UIRefreshControl used by TableView to do pull-to-refresh only works with iOS 6.0+, in this case, you need to add version check in your code to ensure you only use the api with supported iOS
iOS environment check - http://docs.xamarin.com/recipes/ios/general/projects/environment_checks/
2. IB .xib file Notes: when creating .xib file with XCode, ensure you set correct target iOS version in "Builds for" property under Interface Builder Document panel, and note that "Use Autolayout" chekbox can only be used for iOS 6.0+
references:
3. How to hide keyboard on touching anywhere else and notes with iOS 6 before:
below code should work for iOS 6+:
var g = new UITapGestureRecognizer(() => View.EndEditing(true));
View.AddGestureRecognizer(g);
but except one thing when targeting on iOS5, any button Touch event like TouchUpInside on the view will not be fired (see http://stackoverflow.com/questions/13515539/uibutton-not-works-in-ios-5-x-everything-is-fine-in-ios-6-x)
and the easiest solution I found is as per this http://stackoverflow.com/questions/3344341/uibutton-inside-a-view-that-has-a-uitapgesturerecognizer
var g = new UITapGestureRecognizer(() => View.EndEditing(true));
g.CancelsTouchesInView = false; //for iOS5
View.AddGestureRecognizer(g);
4. To use MvvmCross, need to add reference to System.Windows.dll
5. To use System.IO.Compression directly or PCL requires reference to System.IO.Compression, in iOS app project, you need to add references to System.IO.Compression.dll
6. MvvmCross + Pull-to-Refresh for MvxTableViewContoller
http://motzcod.es/post/59125989518/mvxuirefreshcontrol-for-mvvmcross
Notes: this doesn't work for version before iOS 6, as this feature is added since iOS6
7. How to implement a Busy Indicator
http://docs.xamarin.com/recipes/ios/standard_controls/popovers/display_a_loading_message/
8. MvvmCross + Swipe-to-Delete for MvxTableViewController
http://motzcod.es/post/64077370252/simple-re-usable-swipe-to-delete-xamarin-ios
9. How to detect default back button clicked in navigation bar
public override void ViewWillDisappear (bool animated)
{
if (!NavigationController.ViewControllers.Contains (this)) {
//back button was pressed. We know this is true because self is no longer in the navigation stack
}
base.ViewWillDisappear (animated);
}
Xamarin Studio and Debug
1. Current version of Xamarin Studio (Mac) 4.2.3 doesn't support break point in PCL, but the output by System.Diagnostics.Debug.WriteLine is available in Application Output
2. Debug with Xamarin Studio (Mac):
use Xamarin Studio - Run > Start with debugging to start debug
if any unhanded exception occurred in PCL, you can see the details from Xamarin Studio - View > Pads > Application Output
3. when creating new class in Xamarin Studio, the class' namespace down't follow the dir which isn't like VS c# does. There is an option to enable it in solution Optins > Source Code - > .Net Naming Policies
Known Issues of Xamarin Studio for Mac
1.Solution failed to load with message "Load operation failed. There must be 2, 3 or 4 components in the version string"
- https://forums.xamarin.com/discussion/13881/load-operation-failed-there-must-be-2-3-or-4-components-in-the-version-string
iOS Simulator
1. app data location: /Users/[your name]/Library/Applicaiton Support/iPhone Simulator/[version]/Applications/[app id]/
2. screenshot location: /Users/[your name]/Desktop/
Install Ad-Hoc build on device
1. In iTunes (version 11), ensure Side Bar is showing (click the menu icon in top-left corner, select "Show Menu Bar", in menu bar, select View - > Show Side Bar)
2. Connect device with iTunes
3. Drag and Drop both the provision files and the .ipa file to the empty area at the bottom of side bar
4. Sync to device
Blogs
blog of James Montemagno Developer Evangelist at Xamarin http://motzcod.es/
Mac Tips
1. How to open multiple instances of an application on Mac e.g. open two Xamarin Studio, open Terminal, then type open -n /Applications/'Xamarin Studio.app'
[todo: more notes coming]
Xamarin Studio and Debug
1. Current version of Xamarin Studio (Mac) 4.2.3 doesn't support break point in PCL, but the output by System.Diagnostics.Debug.WriteLine is available in Application Output
2. Debug with Xamarin Studio (Mac):
use Xamarin Studio - Run > Start with debugging to start debug
if any unhanded exception occurred in PCL, you can see the details from Xamarin Studio - View > Pads > Application Output
3. when creating new class in Xamarin Studio, the class' namespace down't follow the dir which isn't like VS c# does. There is an option to enable it in solution Optins > Source Code - > .Net Naming Policies
Known Issues of Xamarin Studio for Mac
1.Solution failed to load with message "Load operation failed. There must be 2, 3 or 4 components in the version string"
- https://forums.xamarin.com/discussion/13881/load-operation-failed-there-must-be-2-3-or-4-components-in-the-version-string
iOS Simulator
1. app data location: /Users/[your name]/Library/Applicaiton Support/iPhone Simulator/[version]/Applications/[app id]/
2. screenshot location: /Users/[your name]/Desktop/