transistorsoft / capacitor-background-fetch

Periodic callbacks in the background for both IOS and Android
78 stars 9 forks source link

Bug: error: linker command failed with exit code 1 #16

Closed Sampath-Lokuge closed 3 months ago

Sampath-Lokuge commented 1 year ago

Hi,

package.json

{ "name": "se", "version": "1.0.0", "author": "se", "homepage": "se", "scripts": { "ng": "ng", "start": "ng serve", "build": "ng build", "lint": "ng lint" }, "private": true, "dependencies": { "@angular/cdk": "^14.0.0", "@angular/common": "14.0.0", "@angular/core": "14.0.0", "@angular/forms": "14.0.0", "@angular/platform-browser": "14.0.0", "@angular/platform-browser-dynamic": "14.0.0", "@angular/router": "14.0.0", "@angular/youtube-player": "^14.0.0", "@awesome-cordova-plugins/core": "6.2.0", "@awesome-cordova-plugins/in-app-browser": "6.2.0", "@awesome-cordova-plugins/insomnia": "6.2.0", "@capacitor-community/barcode-scanner": "^3.0.1", "@capacitor-community/bluetooth-le": "2.0.1", "@capacitor/android": "4.3.0", "@capacitor/app": "4.0.1", "@capacitor/browser": "4.0.1", "@capacitor/camera": "^4.1.4", "@capacitor/core": "^4.3.0", "@capacitor/device": "4.1.0", "@capacitor/geolocation": "4.1.0", "@capacitor/haptics": "4.0.1", "@capacitor/ios": "4.4.0", "@capacitor/keyboard": "4.0.1", "@capacitor/preferences": "4.0.1", "@capacitor/splash-screen": "4.1.0", "@capacitor/status-bar": "4.0.1", "@ionic/angular": "6.1.9", "@transistorsoft/capacitor-background-fetch": "^1.0.3", "@types/lodash": "4.14.185", "cordova-plugin-inappbrowser": "5.0.0", "cordova-plugin-insomnia": "4.3.0", "dayjs": "1.11.5", "ionicons": "6.0.3", "lodash": "4.17.21", "rxjs": "6.6.0", "tslib": "2.2.0", "zone.js": "0.11.4" }, "devDependencies": { "@angular-devkit/build-angular": "14.2.10", "@angular-eslint/builder": "13.0.1", "@angular-eslint/eslint-plugin": "13.0.1", "@angular-eslint/eslint-plugin-template": "13.0.1", "@angular-eslint/template-parser": "13.0.1", "@angular/cli": "14.0.0", "@angular/compiler": "14.0.0", "@angular/compiler-cli": "14.0.0", "@angular/language-service": "14.0.0", "@capacitor/cli": "^4.3.0", "@ionic/angular-toolkit": "6.0.0", "@types/node": "12.11.1", "@typescript-eslint/eslint-plugin": "5.3.0", "@typescript-eslint/parser": "5.3.0", "eslint": "7.6.0", "eslint-plugin-import": "2.22.1", "eslint-plugin-jsdoc": "30.7.6", "eslint-plugin-prefer-arrow": "1.2.2", "ts-node": "8.3.0", "typescript": "4.7.3" }, "description": "se" }

ionic info:

Ionic:

Ionic CLI : 6.19.0 (/usr/local/lib/node_modules/@ionic/cli) Ionic Framework : @ionic/angular 6.1.9 @angular-devkit/build-angular : 14.2.10 @angular-devkit/schematics : 14.0.0 @angular/cli : 14.0.0 @ionic/angular-toolkit : 6.0.0

Capacitor:

Capacitor CLI : 4.7.1 @capacitor/android : 4.3.0 @capacitor/core : 4.7.1 @capacitor/ios : 4.4.0

Utility:

cordova-res (update available: 0.15.4) : 0.15.3 native-run : 1.7.2

System:

NodeJS : v16.14.2 (/usr/local/bin/node) npm : 8.5.0 OS : macOS

Error:

ld: in /Users/sampath/Library/Developer/Xcode/DerivedData/App-eyizjewzpltdzgbapgcghtizmnbr/Build/Products/Debug-iphoneos/TSBackgroundFetch.framework/TSBackgroundFetch(TSBackgroundFetch_vers.o), building for iOS, but linking in object file built for Mac Catalyst, file '/Users/sampath/Library/Developer/Xcode/DerivedData/App-eyizjewzpltdzgbapgcghtizmnbr/Build/Products/Debug-iphoneos/TSBackgroundFetch.framework/TSBackgroundFetch' for architecture arm64 clang: error: linker command failed with exit code 1 (use -v to see invocation)

Xcode

Version 14.1 (14B47b)

Device

Any iOS device(arm64)

Plugin config provided to BackgroundFetch.configure:

 private async initBackgroundFetch(): Promise<void> {
    const status = await BackgroundFetch.configure(
      {
        minimumFetchInterval: 15,
        stopOnTerminate: false,
        enableHeadless: true,
      },
      async (taskId) => {
        // Perform your work in an awaited Promise
        await this.scanBle();

        // [REQUIRED] Signal to the OS that your work is complete.
        BackgroundFetch.finish(taskId);
      },
      async (taskId) => {
        // [REQUIRED] Signal to the OS that your work is complete.
        BackgroundFetch.finish(taskId);
      }
    );
  }

I have tried almost everything here. But still the same error above:

https://github.com/transistorsoft/capacitor-background-fetch/issues/2

christocracy commented 1 year ago

I suggest you attempt to reproduce in a freshly generated HelloWorld app.

Sampath-Lokuge commented 1 year ago

Sure, I'll try that and will share it with you if that too will have the same issue. Thanks!

Sampath-Lokuge commented 1 year ago

I can see the same build error there too. Please see the sample app here: https://github.com/Sampath-Lokuge/capacitor-background-fetch

Note: I have not done any code here. But I have added the native plugin and its configurations for the iOS platform.

Please let me know the issue here. Thanks!

christocracy commented 1 year ago

Your simple HelloWorld app launches for me in XCode. The problem is on your end.

$ git clone https://github.com/Sampath-Lokuge/capacitor-background-fetch.git
$ cd capacitor-background-fetch
$ yarn install
$ npx cap sync
Screenshot 2023-03-20 at 12 48 55 PM
Sampath-Lokuge commented 1 year ago

No issues with the Simulator. But it is not working with the native iOS device and Any iOS device(arm64) platforms. i.e. not build. Your thoughts?

Note: Please get the latest too.

christocracy commented 1 year ago

Boots fine on my iPhone 12 Pro @ 16.3.1. The problem is on your end. This is not an issue with the plugin.

(I fetched the lastest)

 $ git log
commit 5d2527814023ddd62b761d947406aa6e0891a476 (HEAD -> main, origin/main, origin/HEAD)
Author: Sampath-Lokuge <sugeesampathlokuge@gmail.com>
Date:   Mon Mar 20 22:34:11 2023 +0530

    iOS build

commit f247ba01008e95c349a61392092afd04c1b94291
Author: Sampath-Lokuge <sugeesampathlokuge@gmail.com>
Date:   Mon Mar 20 22:03:05 2023 +0530

    iOS build

commit 8f0d161aa6447509af8fcbbfb0fc887125f9d4ec
Author: Sampath-Lokuge <sugeesampathlokuge@gmail.com>
Date:   Mon Mar 20 20:22:34 2023 +0530

    Initial commit
Sampath-Lokuge commented 1 year ago

Can I have the build screen of Any iOS device(arm64)?

christocracy commented 1 year ago
Screenshot 2023-03-20 at 1 24 11 PM
Sampath-Lokuge commented 1 year ago

Hmm... Can you tell me what issues are in my environment? And your Xcode and MAC OS versions?

christocracy commented 1 year ago

I always use latest XCode (14.2) Mac OS 13.2.1

christocracy commented 1 year ago

Can you tell me what issues are in my environment?

I have no idea. You are the only one reporting this.

Sampath-Lokuge commented 1 year ago

I have upgraded to the latest. But still the same error. Do you need any logs from me to give any further help?

XCode (14.2) Mac OS 13.2.1

github-actions[bot] commented 4 months ago

This issue is stale because it has been open for 30 days with no activity.

github-actions[bot] commented 3 months ago

This issue was closed because it has been inactive for 14 days since being marked as stale.