---
# System prepended metadata

title: 'Creating a staging iOS C+ - Thurs, Fri 21st-22nd Jan, 2020'
tags: [staging, programmingjournal, debounce, '2021', fastlane]

---

# Creating a staging iOS C+ - Thurs, Fri 21st-22nd Jan, 2020

### Staging app

An interesting thing I worked on was creating a process for us to do staging test builds for our iOS app.

This is useful for things like testing push notifications, where it is useful to have an entirely different app build with a different push notification ID to make sure we never inadvertently send incorrect notifications to prod devices.

The way I did this was create a seperate app in App Store Connct, with a different Bundle ID, then have a new Fastlane lane that modified Connect+'s bundle ID to match and changed the provisioning profile before building and pushing to "that" app's TestFlight.

In `Appfile`:
```ruby=
for_platform :ios do
    for_lane :staging do
      app_identifier 'my-app-test'
    end
  end
```

In `Fastfile`:
```ruby=
get_provisioning_profile( 
  output_path: "./builds",
  provisioning_name: "my-app-test AppStore", # use test profile
  filename: "provisioning.mobileprovision", # Rename the local provisioning profile
  api_key: api_key
)
```

https://docs.fastlane.tools/actions/upload_to_testflight/
https://docs.fastlane.tools/advanced/Appfile/#appfile
https://docs.fastlane.tools/actions/update_app_identifier/

### TextInput performance improvements with debouncing
We had some issues where a lot of text entry was causing the app to lag a lot. The solution was to debounce the Formik state update:

```typescript=
const { callback: debouncedSetFormikFieldCallback } = useDebouncedCallback(() => {
    handleChange('message')(textValue)
}, 500)

const handleTextChange = (text: string) => {
    setTextValue(text)
    debouncedSetFormikFieldCallback()
}
```

###### tags: `programmingjournal` `2021` `fastlane` `debounce` `staging`