<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: Raheel</title>
    <description>The latest articles on DEV Community by Raheel (@raheel).</description>
    <link>https://dev.to/raheel</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F113740%2Fd76e4a31-1cca-430f-bafa-1fcc98671ff4.jpeg</url>
      <title>DEV Community: Raheel</title>
      <link>https://dev.to/raheel</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/raheel"/>
    <language>en</language>
    <item>
      <title>Why isn't my Preprocessor Macro working?</title>
      <dc:creator>Raheel</dc:creator>
      <pubDate>Fri, 12 Mar 2021 22:53:32 +0000</pubDate>
      <link>https://dev.to/raheel/why-isn-t-my-preprocessor-macro-working-4b4m</link>
      <guid>https://dev.to/raheel/why-isn-t-my-preprocessor-macro-working-4b4m</guid>
      <description>&lt;p&gt;We have a hybrid Objective-C/Swift app.  All of the new classes are written in Swift, but we still update the Objective-C code for bug fixes and feature enhancements.  In our app, we define Preprocessor Macros and use it for build configuration specific logic e.g. &lt;code&gt;#if DEBUG&lt;/code&gt;.  &lt;/p&gt;

&lt;p&gt;Recently, we had to add support an enterprise build in our app.  An enterprise build is a build where the IPA is stored on the company's internal secure network and served from there.  I added a new configuration, "Enterprise" to our app.  I added the macro under "Apple Clang - Preprocessing" --&amp;gt; "PreProcessor Macros"&lt;br&gt;
&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--la9q9CHj--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/4cic6xo1f7365d0ulj4f.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--la9q9CHj--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/4cic6xo1f7365d0ulj4f.png" alt="alt text"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;However, after making this change and adding the logic to our Swift code nothing happened.  I spent hours trying to see if there was any issue with our logic.  Was there any typos in the variable name?  Had I set the macro in the wrong configuration? Was it a cache issue?  The answer to all these questions were no.  It turns out that the Swift compiler doesn't include a preprocessor.  It takes advantage of compile-time attributes to accomplish the same functionality. We must define them under "Swift Compiler - Custom Flags" --&amp;gt; "Active Compilation Conditions".&lt;br&gt;
&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--R6kNAm4c--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/1tsac06rhvz8bscntnjb.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--R6kNAm4c--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/1tsac06rhvz8bscntnjb.png" alt="alt text"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;After adding the the custom flags, my code worked as expected.  One thing to keep in mind is that if you have both Objective-C and Swift classes relying on a macro, you will need to add it to both places.&lt;/p&gt;

</description>
    </item>
    <item>
      <title>Improving your iOS app ratings with SKStoreReviewController
</title>
      <dc:creator>Raheel</dc:creator>
      <pubDate>Fri, 19 Feb 2021 21:03:43 +0000</pubDate>
      <link>https://dev.to/raheel/improving-your-ios-app-ratings-with-skstorereviewcontroller-2oo</link>
      <guid>https://dev.to/raheel/improving-your-ios-app-ratings-with-skstorereviewcontroller-2oo</guid>
      <description>&lt;h1&gt;
  
  
  Why Ratings Matter
&lt;/h1&gt;

&lt;p&gt;One of the first things that users look at before installing an app is the app's rating on the App Store. Having a good rating increases the app's visibility on the App Store; the higher the rating, the higher it will rank. Research shows that users with a negative experience are more likely to rate the app than those who have had a positive experience. That's why it is so important to ask your current users to rate your app. Asking the user to go to the app store to rate your app isn't effective and also annoying to the user. A better experience for the user is to rate the app without having to leave the screen they are on. This is where SKStoreReviewController comes in. It is used for displaying in-app prompt to rate the app.&lt;/p&gt;

&lt;h1&gt;
  
  
  Guidelines
&lt;/h1&gt;

&lt;p&gt;Apple recommends that in-app rating prompt be only displayed after the user has shown some engagement with the app. For example, if they were able to successfully perform a task, then it makes sense to prompt them for the review. They shouldn't be prompted on app launch, button click, or if they are in the middle of a time-sensitive task. Allow the user to form an opinion of the app before asking for a review. In short, Apple says "Don't be a pest."&lt;/p&gt;

&lt;h1&gt;
  
  
  Using SKStoreReviewController
&lt;/h1&gt;

&lt;p&gt;While using SKStoreReviewController is very simple, the logic for when to use it is the complex part. Here is a sample code:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;import StoreKit
...
    if shouldDisplayReview(){
        SKStoreReviewController.requestReview()
        reviewDisplayed()
    }
...
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The shouldDisplayReview method would contain logic that determines if the user is likely having a good experience in the app and hasn't been shown the prompt recently. For example, you can track the number of times the user has opened the app or successfully completed a task in UserDefaults. If the count is above a certain number, you should display the review.&lt;/p&gt;

&lt;p&gt;The reviewDisplayed method stores the date when the prompt was displayed. It can also reset any counters you use to determine if the user is having a good experience.&lt;/p&gt;

&lt;h1&gt;
  
  
  Limitations
&lt;/h1&gt;

&lt;p&gt;There are many limitations on using SKStoreReviewController:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;You can prompt the user for a rating up to three times within a 365-day period&lt;/li&gt;
&lt;li&gt;Users can go into Settings and turn off in-app ratings prompt&lt;/li&gt;
&lt;li&gt;There are no callbacks in SKStoreReviewController. The app has no way of know if the user rated the app or not.&lt;/li&gt;
&lt;li&gt;The ratings prompt will displayed on XCode builds but the Submit button is grayed out.&lt;/li&gt;
&lt;li&gt;On TestFlight builds, the ratings prompt will not be displayed at all. You will need to create an ad-hoc build if you need to have others test this screen. In my next lesson, I will show you how to create an ad-hoc build.&lt;/li&gt;
&lt;/ul&gt;

</description>
      <category>ios</category>
    </item>
  </channel>
</rss>
