Wednesday, August 31, 2016

Delete Duplicate Simulators

xcrun simctl list devices | grep -v '^[-=]' | cut -d "(" -f2 | cut -d ")" -f1 | xargs -I {} xcrun simctl delete "{}"

Wednesday, June 8, 2016

Set Constraint

        [ChildView setFrame:ParentView.bounds];
        [ParentView addSubview: ChildView];
        [ChildView.centerXAnchor constraintEqualToAnchor: ParentView.centerXAnchor].active = true;

        [ChildView.centerYAnchor constraintEqualToAnchor: ParentView.centerYAnchor].active = true;

Tuesday, May 26, 2015

Do you want the application “Xcode.app” to accept incoming network connections

If you have to allow every time you runs Xcode..
here is the soluation

1. Open command tool
2. sudo /usr/libexec/ApplicationFirewall/socketfilterfw --setglobalstate off

3. /usr/libexec/ApplicationFirewall/socketfilterfw --add /Applications/Xcode.app/Contents/MacOS/Xcode

4. /usr/libexec/ApplicationFirewall/socketfilterfw --add /Applications/Xcode.app/Contents/Developer/Applications/iOS\ Simulator.app/Contents/MacOS/iOS\ Simulator

5. sudo /usr/libexec/ApplicationFirewall/socketfilterfw --setglobalstate on

then restart your system

Tuesday, November 25, 2014

Get Top View of our app

    UIWindow *topWindow = [[[UIApplication sharedApplication].windows sortedArrayUsingComparator:^NSComparisonResult(UIWindow *win1, UIWindow *win2) {
        return win1.windowLevel - win2.windowLevel;
    }] lastObject];

    UIView *topView = [[topWindow subviews] lastObject];

Tuesday, November 18, 2014

Friday, October 31, 2014

Using an NSString in a switch statement

Define Macros

#define CASE(str)                       if ([__s__ isEqualToString:(str)])
#define SWITCH(s)                       for (NSString *__s__ = (s); ; )
#define DEFAULT


SWITCH (string) {
    CASE (@"AAA") {
    CASE (@"BBB") {
    CASE (@"CCC") {

Tuesday, October 28, 2014

Ipad stuck on the red battery charging

Fixes these items on your Ipad:
  • Device continually restarts but never displays the Home screen.
  • An update or restore did not complete and the device is no longer recognized in iTunes.
  • Stops responding, showing the Apple logo with no progress bar or a stopped progress bar, for over ten minutes.
Here’s what you’ll need to do to get your Ipad into DFU mode:
  • Plug the iPad into your computer
  • Launch iTunes
  • Hold down the Power button and the Home button at the same time
  • Keep holding both of these buttons for 10 seconds
  • After 10 seconds pass, release the Power button but continue to hold the Home button for another 3-5 seconds
  • When in DFU mode, your iPad screen will stay completely black. If you see an Apple logo or otherwise you did not enter DFU mode
  • iTunes will notify you that it has detected a device in recovery mode
  • Once in DFU mode the Itunes firmware modifying app will take over, follow those instructions
What is Ipad DFU mode?
DFU stands for Device Firmware Update, entering DFU Mode allows you to update or re install your Ipad, Ipod, or other iOS device’s firmware.