Home Blog Page 2

ios – @react-native-firebase/analytics setup downside after improve No Firebase App ‘[DEFAULT]’ has been created – name firebase.initializeApp()


Error: No Firebase App ‘[DEFAULT]’ has been created – name firebase.initializeApp()

"@react-native-firebase/analytics": "^21.11.0",
"@react-native-firebase/app": "^21.11.0",
"react-native": "0.79.5",
"expo": "^53.0.17",

Earlier than the improve analytics used to work and there was no subject. The config was okay. After the improve we needed to change some js init code and the issues arose. Additionally it’s price mentioning that it really works on android, which leads me to consider that there could be a problem with GoogleService-Information.plist

The setup:

"@react-native-firebase/app"

is added to plugins.

each

google-services.json
GoogleService-Information.plist

are added to .env and uploaded to EXPO

analytics.js

import { getApp } from '@react-native-firebase/app'
import {
  logEvent,
  setAnalyticsCollectionEnabled,
  getAnalytics,
} from '@react-native-firebase/analytics'

const app = getApp()

export default {
  analytics: () => {
    const analytics = getAnalytics(app)
    return {
      logScreenView: params => logEvent(analytics, 'screen_view', params),
      setAnalyticsCollectionEnabled: enabled =>
        setAnalyticsCollectionEnabled(analytics, enabled),
      logEvent: (occasion, params) => logEvent(analytics, occasion, params),
      setUserProperty: (title, worth) => analytics.setUserProperty(title, worth),
    }
  },
}

App.js

import analyticsModule from './lib/analytics'

const analytics = analyticsModule.analytics()
analytics?.setAnalyticsCollectionEnabled(true)

useAuth.getState().addOnSignedInListener(() => {
  analytics?.setUserProperty('logged_in', 'true')
})

useAuth.getState().addOnSignedOutListener(() => {
  analytics?.setUserProperty('logged_in', 'false')
})

GoogleService-Information.plist





    CLIENT_ID
    xxxx.apps.googleusercontent.com
    REVERSED_CLIENT_ID
    com.googleusercontent.apps.xxxx
    ANDROID_CLIENT_ID
    xxxx.apps.googleusercontent.com
    API_KEY
    xxxx
    GCM_SENDER_ID
    xxxxx
    PLIST_VERSION
    1
    BUNDLE_ID
    com.xx.xxxxxx
    PROJECT_ID
    xxxxx-mobile
    STORAGE_BUCKET
    xxxxx-mobile.appspot.com
    IS_ADS_ENABLED
    
    IS_ANALYTICS_ENABLED
    
    IS_APPINVITE_ENABLED
    
    IS_GCM_ENABLED
    
    IS_SIGNIN_ENABLED
    
    GOOGLE_APP_ID
    1:xxxxx:ios:xxxxxxx

Any thought what the difficulty could be?

Nanotechnology World — Controlling Polymer shapes: A brand new era of…


What if a fancy materials might reshape itself in response to a easy chemical sign? A workforce of physicists from the College of Vienna and the College of Edinburgh has proven that even small adjustments in pH worth and thus in electrical cost can shift the spatial association of closed ring-shaped polymers (molecular chains) – by altering the steadiness between twist and writhe, two distinct modes of spatial deformation. Their findings, revealed in Bodily Overview Letters, display how electrical cost can be utilized to reshape polymers in a reversible and controllable manner – opening up new prospects for programmable, responsive supplies. With such supplies, permeability and mechanical properties comparable to elasticity, yield stress and viscosity may very well be higher managed and exactly ‘programmed’.

Think about taking a ribbon and twisting it by half earlier than connecting its ends: you create the well-known Möbius band – a loop with a single twist and a steady floor. Add extra twists earlier than closing the ribbon, and the construction turns into so referred to as supercoiled. Such shapes are widespread in biology and supplies science, particularly in round DNA and artificial (artificially produced) ring polymers. Whether or not and the way the steadiness between twist– the native rotation of the ribbon round its axis – and writhe – the large-scale coiling of the ribbon in area may very well be tuned in a managed and reversible manner remains to be unclear. The analysis workforce got down to examine this query utilizing a mannequin system of ring-shaped polymers, the place electrical cost – launched through pH-dependent ionization – serves as an exterior tuning parameter.

ios – Drawback Producing Signature for Subscription Gives – Error Code 18


I am efficiently utilizing Apple subscriptions in my app, however I am encountering SKErrorCodeDomain error 18 when attempting to use a subscription supply.

I would like apply supply code first time just for subscription.

I’ve tried many answer from on-line search however difficulty will not be fastened.
Under are particulars of what i set in appstore and what i’ve examined.

Subscription Provide Particulars

  • Provide Sort: For the primary month
  • Buyer Eligibility: New, Current, and Expired Subscribers
  • Code Standing: Energetic

Provide Code Creation Steps:

  • App Retailer Join → App → Subscription → Choose Subscription Product → Provide Codes → Add → Add Customized Codes

Signature Era for Promotional Gives

I am following Apple’s documentation to generate a signature:
https://developer.apple.com/documentation/storekit/generating-a-signature-for-promotional-offers

I’ve constructed the payload as instructed:

appBundleId + 'u2063' + keyIdentifier + 'u2063' + productIdentifier + 'u2063' + offerIdentifier + 'u2063' + appAccountToken + 'u2063' + nonce + 'u2063' + timestamp

Keys and Identifiers

  • keyIdentifier, issuerId, and .p8 file are obtained from:
    • App Retailer Join → Customers and Entry → Integrations → In-App Buy
  • Check person created below:
    • App Retailer Join → Customers and Entry → Sandbox → Check Accounts
    • Logged in with this account on the iPhone

What I’ve Tried


Apple’s pattern code to generate a signature

Downloaded from

const specific = require('specific');
const router = specific.Router();

const crypto = require('crypto');
const ECKey = require('ec-key');
const secp256k1 = require('secp256k1');
const uuidv4 = require('uuid/v4');

const KeyEncoder = require('key-encoder');
const keyEncoder = new KeyEncoder('secp256k1');

const fs = require('fs');

perform getKeyID() {
    return "KEYIDXXXXX";
}

router.put up('/supply', perform(req, res) {
    const appBundleID = req.physique.appBundleID;
    const productIdentifier = req.physique.productIdentifier;
    const subscriptionOfferID = req.physique.offerID;
    const applicationUsername = req.physique.applicationUsername;

    const nonce = uuidv4();
    const currentDate = new Date();
    const timestamp = currentDate.getTime();
    const keyID = getKeyID();

    const payload = appBundleID + 'u2063' +
                  keyID + 'u2063' +
                  productIdentifier + 'u2063' +
                  subscriptionOfferID + 'u2063' +
                  applicationUsername  + 'u2063'+
                  nonce + 'u2063' +
                  timestamp;

    // Get the PEM-formatted non-public key string related to the Key ID.
    // const keyString = getKeyStringForID(keyID);
    // Learn the .p8 file
    const keyString = fs.readFileSync('./SubscriptionKey_KEYIDXXXXX.p8', 'utf8');

    // Create an Elliptic Curve Digital Signature Algorithm (ECDSA) object utilizing the non-public key.
    const key = new ECKey(keyString, 'pem');

    // Arrange the cryptographic format used to signal the important thing with the SHA-256 hashing algorithm.
    const cryptoSign = key.createSign('SHA256');

    // Add the payload string to signal.
    cryptoSign.replace(payload);

    /*
        The Node.js crypto library creates a DER-formatted binary worth signature,
        after which base-64 encodes it to create the string that you'll use in StoreKit.
    */
    const signature = cryptoSign.signal('base64');

    /*
        Verify that the signature passes verification by utilizing the ec-key library.
        The verification course of is just like creating the signature, besides it makes use of 'createVerify'
        as a substitute of 'createSign', and after updating it with the payload, it makes use of `confirm` to cross in
        the signature and encoding, as a substitute of `signal` to get the signature.

        This step will not be required, but it surely's helpful to examine when implementing your signature code.
        This helps debug points with signing earlier than sending transactions to Apple.
        If verification succeeds, the subsequent really useful testing step is trying a purchase order
        within the Sandbox atmosphere.
    */
    const verificationResult = key.createVerify('SHA256').replace(payload).confirm(signature, 'base64');
    console.log("Verification outcome: " + verificationResult)

    // Ship the response.
    res.setHeader('Content material-Sort', 'utility/json');
    res.json({ 'keyID': keyID, 'nonce': nonce, 'timestamp': timestamp, 'signature': signature });

});    

module.exports = router;

Postman request and response

Request URL: http://192.168.1.141:3004/supply
Request JSON: {
    "appBundleID":"com.app.bundleid",
    "productIdentifier":"subscription.product.id",
    "offerID":"OFFERCODE1",
    "applicationUsername":"01234b43791ea309a1c3003412bcdaaa09d39a615c379cc246f5f479760629a1"
}
Response JSON: {
    "keyID": "KEYIDXXXXX",
    "nonce": "f98f2cda-c7a6-492f-9f92-e24a6122c0c9",
    "timestamp": 1753510571664,
    "signature": "MEYCIQCnA8UGWhTiCF+F6S55Zl6hpjnm7SC3aAgvmTBmQDnsAgIhAP6xIeRuREyxxx69Ve/qjnONq7pF1cK8TDn82fyePcqz"
}

Xcode Code

func purchase(_ product: SKProduct) {
    let discountOffer = SKPaymentDiscount(
        identifier: "OFFERCODE1",
        keyIdentifier: "KEYIDXXXXX",
        nonce: UUID(uuidString: "f98f2cda-c7a6-492f-9f92-e24a6122c0c9")!,
        signature: "MEYCIQCnA8UGWhTiCF+F6S55Zl6hpjnm7SC3aAgvmTBmQDnsAgIhAP6xIeRuREyxxx69Ve/qjnONq7pF1cK8TDn82fyePcqz",
        timestamp: 1753510571664)
    
    let fee = SKMutablePayment(product: product)
    fee.applicationUsername = "01234b43791ea309a1c3003412bcdaaa09d39a615c379cc246f5f479760629a1"
    fee.paymentDiscount = discountOffer
    SKPaymentQueue.default().add(fee)
}

Difficulty

Even following directions to the documentation and trying numerous mixtures, the supply retains failing with SKErrorCodeDomain error 18.

Has anybody else skilled this? Any strategies as to what could also be amiss or how it may be corrected?

ios – The way to seize the situation occasion (enter/exit) that launched the app from terminated state?


I’m implementing geofencing in my iOS app and working into some issues when the app is terminated (swiped up). I’m utilizing locationManager.startMonitoring(for: area) to provoke monitoring and utilizing locationManager(_ supervisor: CLLocationManager, didEnterRegion area: CLRegion) and didExitRegion to seize when the area boundary is crossed.

When the app is terminated and the primary set off comes by way of, the app launches within the background in response to the situation occasion. This triggers AppDelegate‘s didFinishLaunchingWithOptions and I can see that launchOptions?[UIApplication.LaunchOptionsKey.location] isn’t nil to suggest the situation occasion is why it opened. Nice!

Nevertheless, although the very first line of code in didFinishLaunchingWithOptions is locationManager.delegate = self, it is as if it is too late to seize the precise enter/exit occasion and neither didEnterRegion nor didExitRegion are fired.

Now as an example one other boundary occasion is triggered as a result of I’ve returned residence with out touching the app. This second (and all subsequent) occasions will set off didEnter/ExitRegion as a result of the app continues to be semi-launched from the primary occasion. So I can deal with these efficiently. However “lacking” that first occasion could be very problematic and appears unintended!

Does anybody have any expertise or recommendation on whether or not they’ve had the identical subject or whether or not it is a mistake on my finish?

Thanks!


Related, simplified code inside AppDelegate:

var locationManager: CLLocationManager = {
    let locationManager = CLLocationManager()
    locationManager.allowsBackgroundLocationUpdates = true
    return locationManager
}()

func locationManager(_ supervisor: CLLocationManager, didEnterRegion area: CLRegion) {
    log("didEnterRegion - sid: (area.identifier)")
}

func locationManager(_ supervisor: CLLocationManager, didExitRegion area: CLRegion) {
    log("didExitRegion - sid: (area.identifier)")
}

func startMonitoring() {
    area.notifyOnEntry = true
    area.notifyOnExit = true

    locationManager.startMonitoring(for: area)
    log("Began monitoring")
}

func utility(_ utility: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]? = nil) -> Bool {
    locationManager.delegate = self
    log("LAUNCH")

    // Test if app was launched resulting from location occasion
    if launchOptions?[UIApplication.LaunchOptionsKey.location] != nil {
        // App was launched resulting from location occasion
        log("App launched resulting from location occasion")
    } else {
        startMonitoring()
    }

    return true
}

And instance log output after terminating the app, then strolling out of the boundary after which strolling again contained in the boundary. Notice the launch occurred once I exited at 16:56, however no didExitRegion fired. Then at 16:57 once I entered, there isn’t a launch resulting from it already launching and I efficiently obtain didEnterRegion:

[2025-07-30 16:56:05.392] [INFO] LAUNCH
[2025-07-30 16:56:05.393] [INFO] App launched resulting from location occasion
[2025-07-30 16:57:49.290] [INFO] didEnterRegion - sid: 7285152

AI-Generated Code Poses Main Safety Dangers in Practically Half of All Improvement Duties, Veracode Analysis Reveals   


Whereas AI is turning into higher at producing that useful code, additionally it is enabling attackers to establish and exploit vulnerabilities in that code extra rapidly and successfully. That is making it simpler for less-skilled programmers to assault the code, rising the pace and class of these assaults — making a scenario during which code vulnerabilities are rising at the same time as the power to use them is turning into simpler, in accordance with new analysis from software danger administration software program supplier Veracode.

AI-generated code launched safety vulnerabilities in 45% of 80 curated coding duties throughout greater than 100 LLMs, in accordance with the 2025 GenAI Code Safety Report. The analysis additionally discovered that GenAI fashions selected an insecure methodology to write down code over a safe methodology 45% of the time. So, though AI can create code that’s useful and syntaactically appropriate, the report reveals that safety efficiency has not stored tempo.

“The rise of vibe coding, the place builders depend on AI to generate code, usually with out explicitly defining safety necessities, represents a elementary shift in how software program is constructed,” Jens Wessling, chief know-how officer at Veracode, mentioned in an announcement saying the report. “The primary concern with this pattern is that they don’t must specify safety constraints to get the code they need, successfully leaving safe coding selections to LLMs. Our analysis reveals GenAI fashions make the mistaken decisions practically half the time, and it’s not enhancing.” 

In saying the report, Veracode wrote: “To judge the safety properties of LLM-generated code, Veracode designed a set of 80 code completion duties with recognized potential for safety vulnerabilities in accordance with the MITRE Frequent Weak spot Enumeration (CWE) system, a regular classification of software program weaknesses that may flip into vulnerabilities. The duties prompted greater than 100 LLMs to auto-complete a block of code in a safe or insecure method, which the analysis staff then analyzed utilizing Veracode Static Evaluation. In 45 % of all check instances, LLMs launched vulnerabilities categorised throughout the OWASP (Open Internet Software Safety Undertaking) Prime 10—essentially the most important net software safety dangers.”

Different findings within the report had been that Java was discovered to be the riskiest of programming languages for AI code technology, with a safety failure fee of greater than 70%.  Failure charges of between 38% and 45% had been present in apps creating in Python, C# and JavaScript. The analysis additionally revealed LLMs did not safe code towards cross-site scripting and log injection in 86% and 88%, respectively, in accordance with Veracode. 

 Wessling famous that the analysis confirmed that bigger fashions carry out no higher than smaller fashions, which he mentioned signifies that the vulnerability difficulty is a systemic one, reasonably than an LLM scaling downside.

“AI coding assistants and agentic workflows symbolize the way forward for software program growth, and they’ll proceed to evolve at a speedy tempo,” Wessling concluded. “The problem dealing with each group is making certain safety evolves alongside these new capabilities. Safety can’t be an afterthought if we wish to forestall the buildup of huge safety debt.”