react-native-onesignal icon indicating copy to clipboard operation
react-native-onesignal copied to clipboard

[Bug]: Xcode: Error Build failed while building on iPhone

Open tragicmj opened this issue 4 years ago • 9 comments

What happened?

I am trying to run my application on my iPhone and receiving the following error. It is working fine on Simulator and release builds are also getting built.

React Native - 0.66.1 React Native One Signal - 4.3.6

Screenshot 2022-11-03 at 11 26 31 AM

Steps to reproduce?

1. Building the app on iPhone

What did you expect to happen?

App to get build in iPhone

React Native OneSignal SDK version

4.3.6

Which platform(s) are affected?

  • [X] iOS
  • [ ] Android

Relevant log output

error build: Build input file cannot be found: '/Users/mdjavedakhtar/Library/Developer/Xcode/DerivedData/baa-ejkeyxidrdwrgyctzidcxyrfemfc/Build/Products/Debug-iphoneos/OneSignalNotificationServiceExtension.appex/OneSignalNotificationServiceExtension'. Did you forget to declare this file as an output of a script phase or custom build rule which produces it?

Code of Conduct

  • [x] I agree to follow this project's Code of Conduct

tragicmj avatar Nov 03 '22 06:11 tragicmj

same issue here 😢:

error build: Build input file cannot be found: '../ios/DerivedData/Ripio/Build/Products/Debug-iphoneos/OneSignalNotificationServiceExtension.appex/OneSignalNotificationServiceExtension'. Did you forget to declare this file as an output of a script phase or custom build rule which produces it?

0xJoelero avatar Nov 04 '22 17:11 0xJoelero

same here 😢 😞

marcusjribeiro avatar Nov 08 '22 17:11 marcusjribeiro

same here

hinh-eoh avatar Nov 30 '22 16:11 hinh-eoh

I found a fix:

  • go to Build Settings > Architectures > Release -> and delete the value inside (eg. if is set with the value arm64, delete it) Screenshot 2022-12-15 at 13 49 19

  • also update the OneSignal version on your Podfile pod 'OneSignalXCFramework', '>= 3.11.2', '< 4.0'

0xJoelero avatar Dec 15 '22 16:12 0xJoelero

same issue 😭

HuriHuchi avatar Dec 19 '22 11:12 HuriHuchi

I've solved it!

In my case removing arm64 value from Excluded Architectures > Debug solved the problem. (+ it should be removed from all targets including OnesignalNotificationService)

Screenshot 2022-12-22 at 12 53 19 AM

HuriHuchi avatar Dec 21 '22 15:12 HuriHuchi

Yes, this works, thank you

tragicmj avatar Dec 30 '22 09:12 tragicmj

You save my days @HuriHuchi

yosukapro avatar Jan 02 '24 15:01 yosukapro

using latest react native version using one signal 5.0.0 version also tried 5.2.0

target 'OneSignalNotificationServiceExtension' do use_frameworks! pod 'OneSignalXCFramework', '>= 5.0.0', '< 6.0' end

when Add this facing error on ios

Multiple commands produce '/Users/macbookpro/Library/Developer/Xcode/DerivedData/ParkingApp-aajwjhcrauxeikclvpiaqghkmjju/Build/Products/Debug-iphoneos/XCFrameworkIntermediates/OneSignalXCFramework/OneSignal/OneSignalFramework.framework'

notificationServiceCode

import UserNotifications

import OneSignalExtension

class NotificationService: UNNotificationServiceExtension {

var contentHandler: ((UNNotificationContent) -> Void)?
var receivedRequest: UNNotificationRequest!
var bestAttemptContent: UNMutableNotificationContent?

override func didReceive(_ request: UNNotificationRequest, withContentHandler contentHandler: @escaping (UNNotificationContent) -> Void) {
    self.receivedRequest = request
    self.contentHandler = contentHandler
    self.bestAttemptContent = (request.content.mutableCopy() as? UNMutableNotificationContent)
    
    if let bestAttemptContent = bestAttemptContent {
        /* DEBUGGING: Uncomment the 2 lines below to check this extension is executing
                      Note, this extension only runs when mutable-content is set
                      Setting an attachment or action buttons automatically adds this */
        // print("Running NotificationServiceExtension")
        // bestAttemptContent.body = "[Modified] " + bestAttemptContent.body
        
        OneSignalExtension.didReceiveNotificationExtensionRequest(self.receivedRequest, with: bestAttemptContent, withContentHandler: self.contentHandler)
    }
}

override func serviceExtensionTimeWillExpire() {
    // Called just before the extension will be terminated by the system.
    // Use this as an opportunity to deliver your "best attempt" at modified content, otherwise the original push payload will be used.
    if let contentHandler = contentHandler, let bestAttemptContent =  bestAttemptContent {
        OneSignalExtension.serviceExtensionTimeWillExpireRequest(self.receivedRequest, with: self.bestAttemptContent)
        contentHandler(bestAttemptContent)
    }
}

}

Anyone fixed this?

hashimalikhan-123 avatar Jul 11 '24 22:07 hashimalikhan-123