Wednesday, May 11, 2016

how to install provisioning profile for xcode

I keep forgeting each time I want to register a new device to ad hoc testing without publishing the app to app store


1) Sign in to http://developer.apple.com.
2) Click on "Certificates, Identifiers & Profiles" in the right sidebar.
3) Click on "Devices", then on the + button.
4) Select "Register Multiple Devices" and choose the downloaded device file.
5) Click on "Continue".
6) Confirm the list of imported devices with "Register".
7) Click on "Distribution" below "Provisioning Profiles".
8) Click on the + button, select "Ad Hoc", then click on "Continue".
9) Select your app, then click on "Continue".
10) Select your certificate, then click on "Continue".
11) Now you should see all devices registered in the portal. Select all or just the ones that you want to include in this provisioning profile. Then click on "Continue".
12) Enter a name for the profile. Confirm with "Generate". The portal will now show "Loading…" for some time, then you can download the profile.
13) Drag & drop the downloaded profile to Xcode.... May work if you have already a profile attached you can refresh
  • Xcode menu => Preferences => Accounts.
  • Select the Apple ID in the left panel.
  • Click the View Details button on the right.
  • In the pop-over that follows click the round refresh arrow. ...
  • The provisioning profiles can then be selected in a Mac project under Build Settings => Code Signing => Provisioning Profile.
14) In Xcode, select your project in the left sidebar, then "Build Settings".
15) Enter "code sign" in the search field.
16) Select the line for your release configuration and choose the downloaded profile.
17) Create a build through "Project > Build & Archive".

Sometimes when you build xcode is complaining that UUID blabla profile is not found.

code Sign error: No matching provisioning profile found: Your build settings specify a provisioning profile with the UUID “ffff1f-eff1-4fff-bffb-2948a242e59e”, however, no such provisioning profile was found.

In this case you can manually copy the profile you downloaded to 
~/Library/MobileDevice/Provisioning Profiles

Eg 1ffff1f-eff1-4fff-bffb-2948a242e59e.mobileprovision

and build again

18) To export your app to install using iTunes select
archive menu in Xcode --> Product --> Archive

19) After that select Windows --> Organizer

Tuesday, May 10, 2016

Backup raspberry PI accidently installed on big SD card to smaller SD card and how to seal with format sd card unknown capacity on Windows

You have a 32GB SD card.
You are using 1.8GB of space on it.
You want to back it up into an image that is 1.8GB big, not 32GB big.
Then you want to be able to put it on an SD card that is 2,4,8 or 16GB big.

Make a Backup Image of Raspberry pi SDCARD!

It took a while to get your SD card set up, didn't it? Bet you don't want to have to do that again, do you?

Well,

Back it up!

Forum user, Mac user, and Adafruit Customer phil.drummond took it upon himself to find the best way to back up his system image.

And he found a fast and easy way - a script which quickly creates a clone of your running Raspberry Pi system, ON THE PI ITSELF!

What You'll Need

  • USB SD Card Reader
  • Blank SD Card
  • Booted and Running Raspberry Pi

Get the Script File

First, get a copy of the script file onto your Pi. You can do that in any one of several ways:
  • First, download the file to your computer
If you are looking for rpi-clone, it is now on github and no longer
available from pastebin.

Get it with git:

    $git clone https://github.com/billw2/rpi-clone.git


To view the rpi-clone README file, go to:

Run the Script

  1. Put the blank SD card into your USB Card Reader, and plug it into one of the PI's USB ports.
  2. Open a Terminal window on the Pi
  3. Navigate to the folder where you stored the script file. (If you stored the file on the Pi's Desktop, simply type 'cd Desktop')
learn_raspberry_pi_script_1.png
When you run the script, you will have to specify the name of your SD card. Raspbian and occidentalis assign the names 'sda', sdb', etc. to SD cards found on USB. If you only have one USB card reader attached, the name of your new SD card will be 'sda'.If you're not sure that sda is the right card, you can run this command to list the cards connected to your Pi. 

  1. sudo fdisk -l
The SD card slot with your running Pi system will show up as /dev/mmcblk0. Your blank card will be listed as /dev/sda1 (or possibly /dev/sdb1, if you have more than one USB card readers attached to the Pi).

Note that you don't enter the '1' - if your card is listed as '/dev/sda1', then you would still enter 'sda' when you run the script ('sda' is the name of the card, 'sda1' is the name of the first partition on the card).

Ok, so now you should be ready to run the commands
  1. chmod +x rpi-clone.sh
  2. sudo ./rpi_clone sda -f
As noted earlier, the first parameter passed to the script is is the name of the target SD card, in this case 'sda'. The -f tells the script to entirely re-format the card.

The script will ask you if you're sure you want to initialize the destination card. Type 'y', and hit the return key.
learn_raspberry_pi_script_2.png

Next, the script will ask you if you want to give your new backup a label. It's not necessary to do this - just hit the return key.
learn_raspberry_pi_script_3.png
Finally, the script will ask you if you're sure you really want to do this, before it begins creating the backup. Type 'y', and hit the return key.


learn_raspberry_pi_script_4.png

Now it's time to wait - the process will take a little while.
learn_raspberry_pi_script_5.png
When the process is complete, the script will ask if it should unmount the card with your new system clone/ Reply with 'y', and you're done!
Now you can shutdown the Pi, swap the clone into the Pi's SD Card Slot, and restart - Bingo! a fully-operational clone of your Raspberry Pi system!

Problems?

If you see an error message like this:
learn_raspberry_pi_script_error1.png
...it means that your SD card is mounted in the file system. You have to unmount it before you can proceed. In the picture, I'm writing over an earlier clone of my system, which has two partitions: /dev/sda2 and /dev/sda1. You might only have one partition.

In any case, issue the umount command for each mounted partition on your destination SD card:
  1. sudo umount /dev/sda1
learn_raspberry_pi_script_error2.png
Now try to run the script again!


Issue on some sdcard

How can I reclaim the full capacity of an SD Card ?

First, let’s take a peek at what the SD card looks like if you attempt to reclaim the space using Disk Manager as you did:


You can format the tiny 64M FAT32 partition, but the remainder of the SD card remains “Unallocated” after you dump the existing (and inaccessible) Linux partition. No amount of pushing or shoving in the Disk Manager application is going to fix this problem. Instead, we’re going to turn to the simple and effective DISKPART tool.
Open up the Start Menu and type “diskpart” in the run box. Press enter. You’ll be prompted by the Windows UAC to authorize admin access to the DISKPART tool.
A command-prompt-like window will open up, only the prompt will say “DISKPART”. At that prompt, type “list disk”.

In the list output on our machine you can see the computer’s hard drive (119GB) and the removable SD card (14GB). It is absolutely critical you note the proper disk number. DISKPART commands are immediate and without any warning. If you type in the wrong disk number, you’re going to have a really bad time.
After identifying your SD card’s disk number, enter the following command “select disk #” where # is the disk number of your SD card.

Whatever commands you execute after this point will only make changes to the selected disk; now would be a good time to double check you’ve selected the right disk just to be extra safe.
Next, now enter the command “clean”

The clean command zeroes out the sectors of the disk that contain the partition data. If you wished to zero out all data on the SD card you could use “clean all” instead, but unless you have a pressing privacy/security reason for overwriting the the entire SD card with zeros, it’s unwise to waste the read/write cycles of the flash media.
After cleaning the disk, enter the following command “create partition primary”

The command, as the syntax implies, creates a new partition on the disk and sets it to primary. After creating the primary partition, the entire storage capacity of the SD card should be available to Windows. If we peek back into Disk Manager, we no longer see a tiny partition with a huge hunk of unallocated space, but a large partition ready to be formatted:


That’s all there is to it! A little DISKPART wizardy and the SD card is factory fresh again.