Wednesday, June 27, 2018

How to Install an IPA using Xcode


  1. Connect the iOS device to your Mac 
  2. Open Xcode
  3. In the Xcode menu got to Windows ==> Devices and Simulators
  4. In the Devices/Simulators window drag and drop the IPA into the Installed Apps area.



That's it; you now have an IPA on your device.

Tuesday, June 26, 2018

How not to debug an error message

How to make an (idiot) out of you and me

First assume that you know what the error is and don't read them message carefully.

On Thursday I was experimenting with adding a organic compass.  First tried the package react-native-compass.  However this package doesn't seems to work.  Next I tried the package react-native-simple-compass.  This package worked perfectly, although is did seems to popup a calibration screen in the beginning.  Also I had a small heart attack later when I went back to npm page and realize it said 'license none'.  However, when I went the the react-native-simple-compass GITHub site for the source code, I found it has a MIT license.  This simple package work perfect for both iOS and Android.

So I had two packages installed.  One that I am using and one I am not.  After my four days I come back and used a clean folder and pull the repo because I did want to have anything corrupted for the extra package.  Everything work fine for iOS on Monday and Tuesday.  However when I tried to build the Android I got an error message.


1
2
3
4
5
MainApplication.java:8: error: package com.welvarend does not exist

import com.welvarend.CompassPackage;

                    ^

I assumed that something wasn't working for the simple compass.  After a couple of hours of checking the gradle and cleaning a rebuilding the react-native.  I got with a friend and ask if he could help me.  As i went to the line that was the error I realized I was looking at the old package.

Bottom line, read the error message carefully.  Especially if your first pass doesn't fix the problem.



Monday, June 25, 2018

Return Whiplash

Confusing Code

Today I ran into some confusing code.

const wrapper = (element) => {
  if (this.state.myBoolean) {
    return (
      <TouchableWithoutFeedback onPressIn={this.handleAction}>
        <View
          style={{
            position: 'absolute',            
            top: 0,            
            bottom: 0,             
            left: 0,            
            right: 0,          
          }}
          pointerEvents="box-only">
          {element}
        </View>      </TouchableWithoutFeedback>    
     );  
  }
  return element;
};
return wrapper((
  <MyControl
    onCButtonPressed={this.onButtonPressed}
    activeButton={this.state.myBoolean}
  />
));

In this 20+ line of code there are tree separate returns.  Also the code doesn't go from top to bottom.  I felt like I had whiplash by the time I actually figured out what the code was doing.  I personally would have like something mare like this.

if (this.state.myBoolean) {
  return (
    <TouchableWithoutFeedback onPressIn={this.handleAction}>
      <View
        style={{
          position: 'absolute',          
          top: 0,          
          bottom: 0,          
          left: 0,          
          right: 0,        
        }}
        pointerEvents="box-only">
        <MyControl
          onButtonPressed={this.onButtonPressed}
          activeButton={this.state.myBoolean}
        />      </View>    </TouchableWithoutFeedback>  
   );
} else {
  return (
    <MyControl
      onButtonPressed={this.onButtonPressed}
      activeButton={this.state.myBoolean}
    />  );
}

It is about the same number of lines of code, but this I can follow easily.